Ignore:
Timestamp:
Oct 27, 2007, 12:20:25 PM (18 years ago)
Author:
ggaren
Message:

Reviewed by Darin Adler.


Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
computedHash()"
http://bugs.webkit.org/show_bug.cgi?id=15718

  • kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a hash value. Also changed O(n) strlen to O(1) check for empty string. (KJS::Identifier::add):
  • kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string. (KJS::UString::UString): (KJS::UString::operator=):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r27146 r27153  
    126126PassRefPtr<UString::Rep> Identifier::add(const char *c)
    127127{
    128     if (!c)
     128    if (!c) {
     129        UString::Rep::null.hash();
    129130        return &UString::Rep::null;
    130     size_t length = strlen(c);
    131     if (length == 0)
     131    }
     132
     133    if (!c[0]) {
     134        UString::Rep::empty.hash();
    132135        return &UString::Rep::empty;
     136    }
    133137   
    134138    return *identifierTable().add<const char *, CStringTranslator>(c).first;
     
    169173PassRefPtr<UString::Rep> Identifier::add(const UChar *s, int length)
    170174{
    171     if (length == 0)
     175    if (!length) {
     176        UString::Rep::empty.hash();
    172177        return &UString::Rep::empty;
     178    }
    173179   
    174180    UCharBuffer buf = {s, length};
Note: See TracChangeset for help on using the changeset viewer.