1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:07:35 +00:00

Everywhere: Add sv suffix to strings relying on StringView(char const*)

Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
This commit is contained in:
sin-ack 2022-07-11 17:32:29 +00:00 committed by Andreas Kling
parent e5f09ea170
commit 3f3f45580a
762 changed files with 8315 additions and 8316 deletions

View file

@ -370,7 +370,7 @@ void Job::on_socket_connected()
return deferred_invoke([this] { did_fail(Core::NetworkJob::Error::ProtocolFailed); });
}
auto value = line.substring(name.length() + 2, line.length() - name.length() - 2);
if (name.equals_ignoring_case("Set-Cookie")) {
if (name.equals_ignoring_case("Set-Cookie"sv)) {
dbgln_if(JOB_DEBUG, "Job: Received Set-Cookie header: '{}'", value);
m_set_cookie_headers.append(move(value));
@ -388,11 +388,11 @@ void Job::on_socket_connected()
} else {
m_headers.set(name, value);
}
if (name.equals_ignoring_case("Content-Encoding")) {
if (name.equals_ignoring_case("Content-Encoding"sv)) {
// Assume that any content-encoding means that we can't decode it as a stream :(
dbgln_if(JOB_DEBUG, "Content-Encoding {} detected, cannot stream output :(", value);
m_can_stream_response = false;
} else if (name.equals_ignoring_case("Content-Length")) {
} else if (name.equals_ignoring_case("Content-Length"sv)) {
auto length = value.to_uint();
if (length.has_value())
m_content_length = length.value();
@ -485,7 +485,7 @@ void Job::on_socket_connected()
auto encoding = transfer_encoding.value().trim_whitespace();
dbgln_if(JOB_DEBUG, "Job: This content has transfer encoding '{}'", encoding);
if (encoding.equals_ignoring_case("chunked")) {
if (encoding.equals_ignoring_case("chunked"sv)) {
m_current_chunk_remaining_size = -1;
goto read_chunk_size;
} else {