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

@ -101,25 +101,25 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
Vector<JsonValue> sorted_regions = json.as_array().values();
quick_sort(sorted_regions, [](auto& a, auto& b) {
return a.as_object().get("destination").to_string() < b.as_object().get("destination").to_string();
return a.as_object().get("destination"sv).to_string() < b.as_object().get("destination"sv).to_string();
});
for (auto& value : sorted_regions) {
auto& if_object = value.as_object();
auto destination = if_object.get("destination").to_string();
auto gateway = if_object.get("gateway").to_string();
auto genmask = if_object.get("genmask").to_string();
auto interface = if_object.get("interface").to_string();
auto flags = if_object.get("flags").to_u32();
auto destination = if_object.get("destination"sv).to_string();
auto gateway = if_object.get("gateway"sv).to_string();
auto genmask = if_object.get("genmask"sv).to_string();
auto interface = if_object.get("interface"sv).to_string();
auto flags = if_object.get("flags"sv).to_u32();
StringBuilder flags_builder;
if (flags & RTF_UP)
flags_builder.append("U");
flags_builder.append('U');
if (flags & RTF_GATEWAY)
flags_builder.append("G");
flags_builder.append('G');
if (flags & RTF_HOST)
flags_builder.append("H");
flags_builder.append('H');
if (destination_column != -1)
columns[destination_column].buffer = destination;