Changeset 34361 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Jun 4, 2008, 11:10:15 AM (17 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/identifier.cpp
r32799 r34361 29 29 #include <wtf/FastMalloc.h> 30 30 #include <wtf/HashSet.h> 31 #include <wtf/StrHash.h>32 31 #if USE(MULTIPLE_THREADS) 33 32 #include <wtf/ThreadSpecific.h> … … 112 111 return false; 113 112 const UChar *d = r->data(); 114 for (int i = 0; i != length; ++i)115 if (d[i] != s[i])116 return false;117 return true;118 }119 120 bool Identifier::equal(const UString::Rep *r, const UString::Rep *b)121 {122 int length = r->len;123 if (length != b->len)124 return false;125 const UChar *d = r->data();126 const UChar *s = b->data();127 113 for (int i = 0; i != length; ++i) 128 114 if (d[i] != s[i]) -
trunk/JavaScriptCore/kjs/identifier.h
r32222 r34361 66 66 static bool equal(const UString::Rep*, const char*); 67 67 static bool equal(const UString::Rep*, const UChar*, int length); 68 static bool equal(const UString::Rep* , const UString::Rep*);68 static bool equal(const UString::Rep* a, const UString::Rep* b) { return KJS::equal(a, b); } 69 69 70 70 static PassRefPtr<UString::Rep> add(const char*); -
trunk/JavaScriptCore/kjs/ustring.cpp
r33941 r34361 1316 1316 } 1317 1317 1318 bool equal(const UString::Rep* r, const UString::Rep* b) 1319 { 1320 int length = r->len; 1321 if (length != b->len) 1322 return false; 1323 const UChar* d = r->data(); 1324 const UChar* s = b->data(); 1325 for (int i = 0; i != length; ++i) 1326 if (d[i] != s[i]) 1327 return false; 1328 return true; 1329 } 1330 1318 1331 CString UString::UTF8String(bool strict) const 1319 1332 { -
trunk/JavaScriptCore/kjs/ustring.h
r33941 r34361 382 382 int compare(const UString &, const UString &); 383 383 384 bool equal(const UString::Rep*, const UString::Rep*); 385 386 384 387 inline UString::UString() 385 388 : m_rep(&Rep::null) … … 430 433 } 431 434 432 } // namespace 435 } // namespace KJS 436 437 438 namespace WTF { 439 440 template<typename T> struct DefaultHash; 441 template<typename T> struct StrHash; 442 443 template<> struct StrHash<KJS::UString::Rep*> { 444 static unsigned hash(const KJS::UString::Rep* key) { return key->hash(); } 445 static bool equal(const KJS::UString::Rep* a, const KJS::UString::Rep* b) { return KJS::equal(a, b); } 446 static const bool safeToCompareToEmptyOrDeleted = false; 447 }; 448 449 template<> struct StrHash<RefPtr<KJS::UString::Rep> > : public StrHash<KJS::UString::Rep*> { 450 using StrHash<KJS::UString::Rep*>::hash; 451 static unsigned hash(const RefPtr<KJS::UString::Rep>& key) { return key->hash(); } 452 using StrHash<KJS::UString::Rep*>::equal; 453 static bool equal(const RefPtr<KJS::UString::Rep>& a, const RefPtr<KJS::UString::Rep>& b) { return KJS::equal(a.get(), b.get()); } 454 static bool equal(const KJS::UString::Rep* a, const RefPtr<KJS::UString::Rep>& b) { return KJS::equal(a, b.get()); } 455 static bool equal(const RefPtr<KJS::UString::Rep>& a, const KJS::UString::Rep* b) { return KJS::equal(a.get(), b); } 456 457 static const bool safeToCompareToEmptyOrDeleted = false; 458 }; 459 460 template<> struct DefaultHash<KJS::UString::Rep*> { 461 typedef StrHash<KJS::UString::Rep*> Hash; 462 }; 463 464 template<> struct DefaultHash<RefPtr<KJS::UString::Rep> > { 465 typedef StrHash<RefPtr<KJS::UString::Rep> > Hash; 466 }; 467 } // namespace WTF 433 468 434 469 #endif
Note:
See TracChangeset
for help on using the changeset viewer.