1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +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

@ -245,7 +245,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
auto const& object = json.value().as_object();
if (!g_kernel_debuginfo_object.has_value()) {
auto debuginfo_file_or_error = Core::MappedFile::map("/boot/Kernel.debug");
auto debuginfo_file_or_error = Core::MappedFile::map("/boot/Kernel.debug"sv);
if (!debuginfo_file_or_error.is_error()) {
auto debuginfo_file = debuginfo_file_or_error.release_value();
auto debuginfo_image = ELF::Image(debuginfo_file->bytes());
@ -263,7 +263,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
profile_strings.set(string_id, value.to_string());
}
auto const* events_value = object.get_ptr("events");
auto const* events_value = object.get_ptr("events"sv);
if (!events_value || !events_value->is_array())
return Error::from_string_literal("Malformed profile (events is not an array)");
@ -281,12 +281,12 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
event.serial = next_serial;
next_serial.increment();
event.timestamp = perf_event.get("timestamp").to_number<u64>();
event.lost_samples = perf_event.get("lost_samples").to_number<u32>();
event.pid = perf_event.get("pid").to_i32();
event.tid = perf_event.get("tid").to_i32();
event.timestamp = perf_event.get("timestamp"sv).to_number<u64>();
event.lost_samples = perf_event.get("lost_samples"sv).to_number<u32>();
event.pid = perf_event.get("pid"sv).to_i32();
event.tid = perf_event.get("tid"sv).to_i32();
auto type_string = perf_event.get("type").to_string();
auto type_string = perf_event.get("type"sv).to_string();
if (type_string == "sample"sv) {
event.data = Event::SampleData {};
@ -403,7 +403,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
auto maybe_kernel_base = Symbolication::kernel_base();
auto const* stack = perf_event.get_ptr("stack");
auto const* stack = perf_event.get_ptr("stack"sv);
VERIFY(stack);
auto const& stack_array = stack->as_array();
for (ssize_t i = stack_array.values().size() - 1; i >= 0; --i) {