mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +00:00
Take StringView in more places
We should work towards a pattern where we take StringView as function arguments, and store String as member, to push the String construction to the last possible moment.
This commit is contained in:
parent
b55b6cd7fc
commit
7bce096afd
14 changed files with 28 additions and 36 deletions
|
@ -36,15 +36,7 @@ public:
|
|||
m_buffer[m_offset++] = (byte)(value >> 24) & 0xffu;
|
||||
}
|
||||
|
||||
void operator<<(const char* str)
|
||||
{
|
||||
ssize_t len = strlen(str);
|
||||
ASSERT(len >= 0);
|
||||
for (ssize_t i = 0; i < len; ++i)
|
||||
m_buffer[m_offset++] = str[i];
|
||||
}
|
||||
|
||||
void operator<<(const String& value)
|
||||
void operator<<(const StringView& value)
|
||||
{
|
||||
for (ssize_t i = 0; i < value.length(); ++i)
|
||||
m_buffer[m_offset++] = value[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue