mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
Everywhere: Split Error::from_string_literal and Error::from_string_view
Error::from_string_literal now takes direct char const*s, while Error::from_string_view does what Error::from_string_literal used to do: taking StringViews. This change will remove the need to insert `sv` after error strings when returning string literal errors once StringView(char const*) is removed. No functional changes.
This commit is contained in:
parent
c70f45ff44
commit
e5f09ea170
51 changed files with 282 additions and 261 deletions
|
@ -240,7 +240,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
|
||||
auto json = JsonValue::from_string(file->read_all());
|
||||
if (json.is_error() || !json.value().is_object())
|
||||
return Error::from_string_literal("Invalid perfcore format (not a JSON object)"sv);
|
||||
return Error::from_string_literal("Invalid perfcore format (not a JSON object)");
|
||||
|
||||
auto const& object = json.value().as_object();
|
||||
|
||||
|
@ -255,7 +255,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
|
||||
auto const* strings_value = object.get_ptr("strings"sv);
|
||||
if (!strings_value || !strings_value->is_array())
|
||||
return Error::from_string_literal("Malformed profile (strings is not an array)"sv);
|
||||
return Error::from_string_literal("Malformed profile (strings is not an array)");
|
||||
|
||||
HashMap<FlatPtr, String> profile_strings;
|
||||
for (FlatPtr string_id = 0; string_id < strings_value->as_array().size(); ++string_id) {
|
||||
|
@ -265,7 +265,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
|
||||
auto const* events_value = object.get_ptr("events");
|
||||
if (!events_value || !events_value->is_array())
|
||||
return Error::from_string_literal("Malformed profile (events is not an array)"sv);
|
||||
return Error::from_string_literal("Malformed profile (events is not an array)");
|
||||
|
||||
auto const& perf_events = events_value->as_array();
|
||||
|
||||
|
@ -446,7 +446,7 @@ ErrorOr<NonnullOwnPtr<Profile>> Profile::load_from_perfcore_file(StringView path
|
|||
}
|
||||
|
||||
if (events.is_empty())
|
||||
return Error::from_string_literal("No events captured (targeted process was never on CPU)"sv);
|
||||
return Error::from_string_literal("No events captured (targeted process was never on CPU)");
|
||||
|
||||
quick_sort(all_processes, [](auto& a, auto& b) {
|
||||
if (a.pid == b.pid)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue