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/ustring.cpp

    r26688 r27153  
    422422    return;
    423423  }
    424   size_t length = strlen(c);
    425   if (length == 0) {
     424
     425  if (!c[0]) {
    426426    m_rep = &Rep::empty;
    427427    return;
    428428  }
     429
     430  size_t length = strlen(c);
    429431  UChar *d = allocChars(length);
    430432  if (!d)
     
    898900    }
    899901
    900     int l = static_cast<int>(strlen(c));
    901     if (!l) {
     902    if (!c[0]) {
    902903        m_rep = &Rep::empty;
    903904        return *this;
    904905    }
    905906
     907  int l = static_cast<int>(strlen(c));
    906908  UChar *d;
    907909  if (m_rep->rc == 1 && l <= m_rep->capacity && m_rep->baseIsSelf() && m_rep->offset == 0 && m_rep->preCapacity == 0) {
Note: See TracChangeset for help on using the changeset viewer.