Changeset 53677 in webkit
- Timestamp:
- Jan 21, 2010 10:05:46 PM (14 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r53672 r53677 1 2010-01-21 Kwang Yul Seo <skyul@company100.net> 2 3 Reviewed by Maciej Stachowiak. 4 5 Add fastStrDup to FastMalloc 6 https://bugs.webkit.org/show_bug.cgi?id=33937 7 8 The new string returned by fastStrDup is obtained with fastMalloc, 9 and can be freed with fastFree. This makes the memory management 10 more consistent because we don't need to keep strdup allocated pointers 11 and free them with free(). Instead we can use fastFree everywhere. 12 13 * wtf/FastMalloc.cpp: 14 (WTF::fastStrDup): 15 * wtf/FastMalloc.h: 16 1 17 2010-01-21 Brady Eidson <beidson@apple.com> 2 18 -
trunk/JavaScriptCore/wtf/FastMalloc.cpp
r53584 r53677 180 180 return result; 181 181 } 182 183 char* fastStrDup(const char* src) 184 { 185 int len = strlen(src) + 1; 186 char* dup = static_cast<char*>(fastMalloc(len)); 187 188 if (dup) 189 memcpy(dup, src, len); 190 191 return dup; 192 } 182 193 183 194 TryMallocReturnValue tryFastZeroedMalloc(size_t n) -
trunk/JavaScriptCore/wtf/FastMalloc.h
r52791 r53677 34 34 void* fastCalloc(size_t numElements, size_t elementSize); 35 35 void* fastRealloc(void*, size_t); 36 char* fastStrDup(const char*); 36 37 37 38 struct TryMallocReturnValue { … … 189 190 using WTF::tryFastRealloc; 190 191 using WTF::fastFree; 192 using WTF::fastStrDup; 191 193 192 194 #ifndef NDEBUG
Note: See TracChangeset
for help on using the changeset viewer.