Changeset 10634 in webkit for trunk/JavaScriptCore/kjs/ustring.cpp
- Timestamp:
- Sep 27, 2005, 3:37:33 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ustring.cpp
r10556 r10634 36 36 #endif 37 37 38 #include "fast_malloc.h"39 38 #include "ustring.h" 40 39 #include "operations.h" … … 180 179 { 181 180 int sizeInBytes = l * sizeof(UChar); 182 UChar *copyD = static_cast<UChar *>( kjs_fast_malloc(sizeInBytes));181 UChar *copyD = static_cast<UChar *>(fastMalloc(sizeInBytes)); 183 182 memcpy(copyD, d, sizeInBytes); 184 183 … … 239 238 baseString->deref(); 240 239 } else { 241 kjs_fast_free(buf);240 fastFree(buf); 242 241 } 243 242 delete this; … … 361 360 if (requiredLength > r->capacity) { 362 361 int newCapacity = expandedSize(requiredLength, r->preCapacity); 363 r->buf = static_cast<UChar *>( kjs_fast_realloc(r->buf, newCapacity * sizeof(UChar)));362 r->buf = static_cast<UChar *>(fastRealloc(r->buf, newCapacity * sizeof(UChar))); 364 363 r->capacity = newCapacity - r->preCapacity; 365 364 } … … 377 376 int delta = newCapacity - r->capacity - r->preCapacity; 378 377 379 UChar *newBuf = static_cast<UChar *>( kjs_fast_malloc(newCapacity * sizeof(UChar)));378 UChar *newBuf = static_cast<UChar *>(fastMalloc(newCapacity * sizeof(UChar))); 380 379 memcpy(newBuf + delta, r->buf, (r->capacity + r->preCapacity) * sizeof(UChar)); 381 kjs_fast_free(r->buf);380 fastFree(r->buf); 382 381 r->buf = newBuf; 383 382 … … 392 391 UString::UString(char c) 393 392 { 394 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar)));393 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar))); 395 394 d[0] = c; 396 395 rep = Rep::create(d, 1); … … 408 407 return; 409 408 } 410 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * length));409 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * length)); 411 410 for (int i = 0; i < length; i++) 412 411 d[i].uc = c[i]; … … 473 472 // a does not qualify for append, and b does not qualify for prepend, gotta make a whole new string 474 473 int newCapacity = expandedSize(length, 0); 475 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * newCapacity));474 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * newCapacity)); 476 475 memcpy(d, a.data(), aSize * sizeof(UChar)); 477 476 memcpy(d + aSize, b.data(), bSize * sizeof(UChar)); … … 644 643 } 645 644 646 UChar *buffer = static_cast<UChar *>( kjs_fast_malloc(totalLength * sizeof(UChar)));645 UChar *buffer = static_cast<UChar *>(fastMalloc(totalLength * sizeof(UChar))); 647 646 648 647 int maxCount = max(rangeCount, separatorCount); … … 697 696 // this is shared with someone using more capacity, gotta make a whole new string 698 697 int newCapacity = expandedSize(length, 0); 699 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * newCapacity));698 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * newCapacity)); 700 699 memcpy(d, data(), thisSize * sizeof(UChar)); 701 700 memcpy(const_cast<UChar *>(d + thisSize), t.data(), tSize * sizeof(UChar)); … … 741 740 // this is shared with someone using more capacity, gotta make a whole new string 742 741 int newCapacity = expandedSize(length, 0); 743 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * newCapacity));742 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * newCapacity)); 744 743 memcpy(d, data(), thisSize * sizeof(UChar)); 745 744 for (int i = 0; i < tSize; ++i) … … 762 761 // this is empty - must make a new rep because we don't want to pollute the shared empty one 763 762 int newCapacity = expandedSize(1, 0); 764 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * newCapacity));763 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * newCapacity)); 765 764 d[0] = c; 766 765 release(); … … 785 784 // this is shared with someone using more capacity, gotta make a whole new string 786 785 int newCapacity = expandedSize((length + 1), 0); 787 UChar *d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * newCapacity));786 UChar *d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * newCapacity)); 788 787 memcpy(d, data(), length * sizeof(UChar)); 789 788 d[length] = c; … … 847 846 } else { 848 847 release(); 849 d = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * l));848 d = static_cast<UChar *>(fastMalloc(sizeof(UChar) * l)); 850 849 rep = Rep::create(d, l); 851 850 } … … 1153 1152 if (rep->rc > 1 || rep->baseString) { 1154 1153 int l = size(); 1155 UChar *n = static_cast<UChar *>( kjs_fast_malloc(sizeof(UChar) * l));1154 UChar *n = static_cast<UChar *>(fastMalloc(sizeof(UChar) * l)); 1156 1155 memcpy(n, data(), l * sizeof(UChar)); 1157 1156 release();
Note:
See TracChangeset
for help on using the changeset viewer.