Ignore:
Timestamp:
Sep 13, 2013, 5:26:13 PM (12 years ago)
Author:
[email protected]
Message:

Avoid a couple of zero-sized fastMalloc calls
https://bugs.webkit.org/show_bug.cgi?id=121333

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • API/JSStringRefCF.cpp:

(JSStringCopyCFString):
Return an empty constant CFStringRef if the JSStringRef is empty.

  • runtime/JSPropertyNameIterator.cpp:

(JSC::JSPropertyNameIterator::JSPropertyNameIterator):
Don't allocate an empty m_jsStrings array if m_jsStringsSize is 0.

Source/WTF:

  • wtf/text/StringBuffer.h:

(WTF::StringBuffer::StringBuffer):
Initialize m_data to null if m_length is null, and use Checked<size_t> to check for
overflow when multiplying m_length with the character size.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSStringRefCF.cpp

    r152807 r155734  
    5959CFStringRef JSStringCopyCFString(CFAllocatorRef alloc, JSStringRef string)
    6060{
     61    if (!string->length())
     62        return CFSTR("");
     63
    6164    return CFStringCreateWithCharacters(alloc, reinterpret_cast<const UniChar*>(string->characters()), string->length());
    6265}
Note: See TracChangeset for help on using the changeset viewer.