1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:37:34 +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

@ -29,10 +29,10 @@ RemoteProcess::RemoteProcess(pid_t pid)
void RemoteProcess::handle_identify_response(JsonObject const& response)
{
int pid = response.get("pid").to_int();
int pid = response.get("pid"sv).to_int();
VERIFY(pid == m_pid);
m_process_name = response.get("process_name").as_string_or({});
m_process_name = response.get("process_name"sv).as_string_or({});
if (on_update)
on_update();
@ -41,7 +41,7 @@ void RemoteProcess::handle_identify_response(JsonObject const& response)
void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
{
// FIXME: It would be good if we didn't have to make a local copy of the array value here!
auto objects = response.get("objects");
auto objects = response.get("objects"sv);
auto& object_array = objects.as_array();
NonnullOwnPtrVector<RemoteObject> remote_objects;
@ -51,10 +51,10 @@ void RemoteProcess::handle_get_all_objects_response(JsonObject const& response)
VERIFY(value.is_object());
auto& object = value.as_object();
auto remote_object = make<RemoteObject>();
remote_object->address = object.get("address").to_number<FlatPtr>();
remote_object->parent_address = object.get("parent").to_number<FlatPtr>();
remote_object->name = object.get("name").to_string();
remote_object->class_name = object.get("class_name").to_string();
remote_object->address = object.get("address"sv).to_number<FlatPtr>();
remote_object->parent_address = object.get("parent"sv).to_number<FlatPtr>();
remote_object->name = object.get("name"sv).to_string();
remote_object->class_name = object.get("class_name"sv).to_string();
remote_object->json = object;
objects_by_address.set(remote_object->address, remote_object);
remote_objects.append(move(remote_object));