mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
AK: Make CaseInsensitiveStringTraits allocation-free
Instead of calling String::to_lowercase(), do case-insensitive hashing and comparison.
This commit is contained in:
parent
1b6ed558bb
commit
2dd3b54827
3 changed files with 9 additions and 2 deletions
|
@ -305,8 +305,8 @@ struct Traits<String> : public GenericTraits<String> {
|
|||
};
|
||||
|
||||
struct CaseInsensitiveStringTraits : public Traits<String> {
|
||||
static unsigned hash(const String& s) { return s.impl() ? s.to_lowercase().impl()->hash() : 0; }
|
||||
static bool equals(const String& a, const String& b) { return a.to_lowercase() == b.to_lowercase(); }
|
||||
static unsigned hash(String const& s) { return s.impl() ? s.impl()->case_insensitive_hash() : 0; }
|
||||
static bool equals(String const& a, String const& b) { return a.equals_ignoring_case(b); }
|
||||
};
|
||||
|
||||
bool operator<(const char*, const String&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue