mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
AK: Always inline StringView(const char*)
Also use strlen() instead of manually walking the string. This allows GCC to optimize away the strlen() entirely for string literals. :^)
This commit is contained in:
parent
625f6c0d86
commit
268000e166
1 changed files with 2 additions and 5 deletions
|
@ -47,13 +47,10 @@ public:
|
|||
, m_length(length)
|
||||
{
|
||||
}
|
||||
StringView(const char* cstring)
|
||||
[[gnu::always_inline]] inline StringView(const char* cstring)
|
||||
: m_characters(cstring)
|
||||
, m_length(cstring ? strlen(cstring) : 0)
|
||||
{
|
||||
if (cstring) {
|
||||
while (*(cstring++))
|
||||
++m_length;
|
||||
}
|
||||
}
|
||||
|
||||
StringView(const ByteBuffer&);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue