diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-09-13 12:51:20 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-19 20:50:05 +0200 |
commit | d441d6f39bb846989d95bcf5caf387b42414718d (patch) | |
tree | e367e64a75991c554930278175d403c072de6bb8 /Source/WTF/wtf/text/StringHash.h | |
parent | 0060b2994c07842f4c59de64b5e3e430525c4b90 (diff) | |
download | qtwebkit-d441d6f39bb846989d95bcf5caf387b42414718d.tar.gz |
Import Qt5x2 branch of QtWebkit for Qt 5.2
Importing a new snapshot of webkit.
Change-Id: I2d01ad12cdc8af8cb015387641120a9d7ea5f10c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com>
Diffstat (limited to 'Source/WTF/wtf/text/StringHash.h')
-rw-r--r-- | Source/WTF/wtf/text/StringHash.h | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/Source/WTF/wtf/text/StringHash.h b/Source/WTF/wtf/text/StringHash.h index 1928716bd..e1a0c25ea 100644 --- a/Source/WTF/wtf/text/StringHash.h +++ b/Source/WTF/wtf/text/StringHash.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2012 Apple Inc. All rights reserved + * Copyright (C) 2006, 2007, 2008, 2012, 2013 Apple Inc. All rights reserved * Copyright (C) Research In Motion Limited 2009. All rights reserved. * * This library is free software; you can redistribute it and/or @@ -43,29 +43,9 @@ namespace WTF { struct StringHash { static unsigned hash(StringImpl* key) { return key->hash(); } - static bool equal(const StringImpl* a, const StringImpl* b) + static inline bool equal(const StringImpl* a, const StringImpl* b) { - if (a == b) - return true; - if (!a || !b) - return false; - - unsigned aLength = a->length(); - unsigned bLength = b->length(); - if (aLength != bLength) - return false; - - if (a->is8Bit()) { - if (b->is8Bit()) - return WTF::equal(a->characters8(), b->characters8(), aLength); - - return WTF::equal(a->characters8(), b->characters16(), aLength); - } - - if (b->is8Bit()) - return WTF::equal(a->characters16(), b->characters8(), aLength); - - return WTF::equal(a->characters16(), b->characters16(), aLength); + return equalNonNull(a, b); } static unsigned hash(const RefPtr<StringImpl>& key) { return key->hash(); } @@ -112,27 +92,9 @@ namespace WTF { return CaseFoldingHash::hash(reinterpret_cast<const LChar*>(data), length); } - static bool equal(const StringImpl* a, const StringImpl* b) + static inline bool equal(const StringImpl* a, const StringImpl* b) { - if (a == b) - return true; - if (!a || !b) - return false; - unsigned length = a->length(); - if (length != b->length()) - return false; - - if (a->is8Bit()) { - if (b->is8Bit()) - return equalIgnoringCase(a->characters8(), b->characters8(), length); - - return equalIgnoringCase(b->characters16(), a->characters8(), length); - } - - if (b->is8Bit()) - return equalIgnoringCase(a->characters16(), b->characters8(), length); - - return equalIgnoringCase(a->characters16(), b->characters16(), length); + return equalIgnoringCaseNonNull(a, b); } static unsigned hash(const RefPtr<StringImpl>& key) |