Changeset 6360 in webkit for trunk/JavaScriptCore/kjs/identifier.cpp
- Timestamp:
- Apr 13, 2004, 7:33:59 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/identifier.cpp
r4206 r6360 68 68 { 69 69 int length = r->len; 70 const UChar *d = r->dat ;70 const UChar *d = r->data(); 71 71 for (int i = 0; i != length; ++i) 72 72 if (d[i].uc != (unsigned char)s[i]) … … 79 79 if (r->len != length) 80 80 return false; 81 const UChar *d = r->dat ;81 const UChar *d = r->data(); 82 82 for (int i = 0; i != length; ++i) 83 83 if (d[i].uc != s[i].uc) … … 91 91 if (length != b->len) 92 92 return false; 93 const UChar *d = r->dat ;94 const UChar *s = b->dat ;93 const UChar *d = r->data(); 94 const UChar *s = b->data(); 95 95 for (int i = 0; i != length; ++i) 96 96 if (d[i].uc != s[i].uc) … … 123 123 } 124 124 125 UChar *d = new UChar[length];125 UChar *d = static_cast<UChar *>(malloc(sizeof(UChar) * length)); 126 126 for (int j = 0; j != length; j++) 127 127 d[j] = c[j]; 128 128 129 UString::Rep *r = new UString::Rep; 130 r->dat = d; 131 r->len = length; 132 r->capacity = UString::Rep::capacityForIdentifier; 129 UString::Rep *r = UString::Rep::create(d, length); 130 r->isIdentifier = 1; 133 131 r->rc = 0; 134 132 r->_hash = hash; … … 164 162 } 165 163 166 UChar *d = new UChar[length];164 UChar *d = static_cast<UChar *>(malloc(sizeof(UChar) * length)); 167 165 for (int j = 0; j != length; j++) 168 166 d[j] = s[j]; 169 167 170 UString::Rep *r = new UString::Rep; 171 r->dat = d; 172 r->len = length; 173 r->capacity = UString::Rep::capacityForIdentifier; 168 UString::Rep *r = UString::Rep::create(d, length); 169 r->isIdentifier = 1; 174 170 r->rc = 0; 175 171 r->_hash = hash; … … 186 182 UString::Rep *Identifier::add(UString::Rep *r) 187 183 { 188 if (r-> capacity == UString::Rep::capacityForIdentifier)184 if (r->isIdentifier) 189 185 return r; 190 186 if (r->len == 0) … … 207 203 } 208 204 209 r-> capacity = UString::Rep::capacityForIdentifier;205 r->isIdentifier = 1; 210 206 211 207 _table[i] = r;
Note:
See TracChangeset
for help on using the changeset viewer.