mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 19:57:36 +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
|
@ -127,11 +127,11 @@ String Backtrace::Entry::to_string(bool color) const
|
|||
StringBuilder builder;
|
||||
builder.appendff("{:p}: ", eip);
|
||||
if (object_name.is_empty()) {
|
||||
builder.append("???");
|
||||
builder.append("???"sv);
|
||||
return builder.build();
|
||||
}
|
||||
builder.appendff("[{}] {}", object_name, function_name.is_empty() ? "???" : function_name);
|
||||
builder.append(" (");
|
||||
builder.append(" ("sv);
|
||||
|
||||
Vector<Debug::DebugInfo::SourcePosition> source_positions;
|
||||
|
||||
|
@ -146,10 +146,10 @@ String Backtrace::Entry::to_string(bool color) const
|
|||
|
||||
for (size_t i = 0; i < source_positions.size(); ++i) {
|
||||
auto& position = source_positions[i];
|
||||
auto fmt = color ? "\033[34;1m{}\033[0m:{}" : "{}:{}";
|
||||
auto fmt = color ? "\033[34;1m{}\033[0m:{}"sv : "{}:{}"sv;
|
||||
builder.appendff(fmt, LexicalPath::basename(position.file_path), position.line_number);
|
||||
if (i != source_positions.size() - 1) {
|
||||
builder.append(" => ");
|
||||
builder.append(" => "sv);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -196,14 +196,14 @@ Optional<MemoryRegionInfo> Reader::region_containing(FlatPtr address) const
|
|||
int Reader::process_pid() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto pid = process_info.get("pid");
|
||||
auto pid = process_info.get("pid"sv);
|
||||
return pid.to_number<int>();
|
||||
}
|
||||
|
||||
u8 Reader::process_termination_signal() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto termination_signal = process_info.get("termination_signal");
|
||||
auto termination_signal = process_info.get("termination_signal"sv);
|
||||
auto signal_number = termination_signal.to_number<u8>();
|
||||
if (signal_number <= SIGINVAL || signal_number >= NSIG)
|
||||
return SIGINVAL;
|
||||
|
@ -213,14 +213,14 @@ u8 Reader::process_termination_signal() const
|
|||
String Reader::process_executable_path() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto executable_path = process_info.get("executable_path");
|
||||
auto executable_path = process_info.get("executable_path"sv);
|
||||
return executable_path.as_string_or({});
|
||||
}
|
||||
|
||||
Vector<String> Reader::process_arguments() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto arguments = process_info.get("arguments");
|
||||
auto arguments = process_info.get("arguments"sv);
|
||||
if (!arguments.is_array())
|
||||
return {};
|
||||
Vector<String> vector;
|
||||
|
@ -234,7 +234,7 @@ Vector<String> Reader::process_arguments() const
|
|||
Vector<String> Reader::process_environment() const
|
||||
{
|
||||
auto process_info = this->process_info();
|
||||
auto environment = process_info.get("environment");
|
||||
auto environment = process_info.get("environment"sv);
|
||||
if (!environment.is_array())
|
||||
return {};
|
||||
Vector<String> vector;
|
||||
|
|
|
@ -26,7 +26,7 @@ struct MemoryRegionInfo {
|
|||
|
||||
StringView object_name() const
|
||||
{
|
||||
if (region_name.contains("Loader.so"))
|
||||
if (region_name.contains("Loader.so"sv))
|
||||
return "Loader.so"sv;
|
||||
auto maybe_colon_index = region_name.find(':');
|
||||
if (!maybe_colon_index.has_value())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue