mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 09:24:57 +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:
parent
e5f09ea170
commit
3f3f45580a
762 changed files with 8315 additions and 8316 deletions
|
@ -167,15 +167,15 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
}
|
||||
|
||||
if (is_binary && binary_mode == BinaryFileMode::Binary) {
|
||||
outln(colored_output ? "binary file \x1B[34m{}\x1B[0m matches" : "binary file {} matches", filename);
|
||||
outln(colored_output ? "binary file \x1B[34m{}\x1B[0m matches"sv : "binary file {} matches"sv, filename);
|
||||
} else {
|
||||
if ((result.matches.size() || invert_match) && print_filename)
|
||||
out(colored_output ? "\x1B[34m{}:\x1B[0m" : "{}:", filename);
|
||||
out(colored_output ? "\x1B[34m{}:\x1B[0m"sv : "{}:"sv, filename);
|
||||
if ((result.matches.size() || invert_match) && line_numbers)
|
||||
out(colored_output ? "\x1B[35m{}:\x1B[0m" : "{}:", line_number);
|
||||
out(colored_output ? "\x1B[35m{}:\x1B[0m"sv : "{}:"sv, line_number);
|
||||
|
||||
for (auto& match : result.matches) {
|
||||
out(colored_output ? "{}\x1B[32m{}\x1B[0m" : "{}{}",
|
||||
out(colored_output ? "{}\x1B[32m{}\x1B[0m"sv : "{}{}"sv,
|
||||
StringView(&str[last_printed_char_pos], match.global_offset - last_printed_char_pos),
|
||||
match.view.to_string());
|
||||
last_printed_char_pos = match.global_offset + match.view.length();
|
||||
|
@ -261,7 +261,7 @@ ErrorOr<int> serenity_main(Main::Arguments args)
|
|||
if (is_binary && binary_mode == BinaryFileMode::Skip)
|
||||
return 1;
|
||||
|
||||
auto matched = matches(line_view, "stdin", line_number, false, is_binary);
|
||||
auto matched = matches(line_view, "stdin"sv, line_number, false, is_binary);
|
||||
did_match_something = did_match_something || matched;
|
||||
if (matched && is_binary && binary_mode == BinaryFileMode::Binary)
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue