1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

AK: Reduce header dependency graph of String.h

String.h no longer pulls in StringView.h. We do this by moving a bunch
of String functions out-of-line.
This commit is contained in:
Andreas Kling 2020-03-23 13:45:10 +01:00
parent 1dd71bd68f
commit 7d862dd5fc
39 changed files with 122 additions and 77 deletions

View file

@ -200,4 +200,17 @@ unsigned StringView::hash() const
return string_hash(characters_without_null_termination(), length());
}
bool StringView::operator==(const String& string) const
{
if (string.is_null())
return !m_characters;
if (!m_characters)
return false;
if (m_length != string.length())
return false;
if (m_characters == string.characters())
return true;
return !__builtin_memcmp(m_characters, string.characters(), m_length);
}
}