mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +00:00
Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
This commit is contained in:
parent
3f3f45580a
commit
c8585b77d2
86 changed files with 283 additions and 283 deletions
|
@ -2665,7 +2665,7 @@ RefPtr<Value> ReadRedirection::run(RefPtr<Shell> shell)
|
|||
return make_ref_counted<ListValue>({});
|
||||
|
||||
StringBuilder builder;
|
||||
builder.join(" ", path_segments);
|
||||
builder.join(' ', path_segments);
|
||||
|
||||
command.redirections.append(PathRedirection::create(builder.to_string(), m_fd, PathRedirection::Read));
|
||||
return make_ref_counted<CommandValue>(move(command));
|
||||
|
@ -2695,7 +2695,7 @@ RefPtr<Value> ReadWriteRedirection::run(RefPtr<Shell> shell)
|
|||
return make_ref_counted<ListValue>({});
|
||||
|
||||
StringBuilder builder;
|
||||
builder.join(" ", path_segments);
|
||||
builder.join(' ', path_segments);
|
||||
|
||||
command.redirections.append(PathRedirection::create(builder.to_string(), m_fd, PathRedirection::ReadWrite));
|
||||
return make_ref_counted<CommandValue>(move(command));
|
||||
|
@ -3052,7 +3052,7 @@ void Juxtaposition::highlight_in_editor(Line::Editor& editor, Shell& shell, High
|
|||
|
||||
StringBuilder path_builder;
|
||||
path_builder.append(tilde_value);
|
||||
path_builder.append("/");
|
||||
path_builder.append('/');
|
||||
path_builder.append(bareword_value);
|
||||
auto path = path_builder.to_string();
|
||||
|
||||
|
@ -3183,8 +3183,8 @@ RefPtr<Value> StringPartCompose::run(RefPtr<Shell> shell)
|
|||
return make_ref_counted<ListValue>({});
|
||||
|
||||
StringBuilder builder;
|
||||
builder.join(" ", left);
|
||||
builder.join(" ", right);
|
||||
builder.join(' ', left);
|
||||
builder.join(' ', right);
|
||||
|
||||
return make_ref_counted<StringValue>(builder.to_string());
|
||||
}
|
||||
|
@ -3347,7 +3347,7 @@ RefPtr<Value> WriteAppendRedirection::run(RefPtr<Shell> shell)
|
|||
return make_ref_counted<ListValue>({});
|
||||
|
||||
StringBuilder builder;
|
||||
builder.join(" ", path_segments);
|
||||
builder.join(' ', path_segments);
|
||||
|
||||
command.redirections.append(PathRedirection::create(builder.to_string(), m_fd, PathRedirection::WriteAppend));
|
||||
return make_ref_counted<CommandValue>(move(command));
|
||||
|
@ -3377,7 +3377,7 @@ RefPtr<Value> WriteRedirection::run(RefPtr<Shell> shell)
|
|||
return make_ref_counted<ListValue>({});
|
||||
|
||||
StringBuilder builder;
|
||||
builder.join(" ", path_segments);
|
||||
builder.join(' ', path_segments);
|
||||
|
||||
command.redirections.append(PathRedirection::create(builder.to_string(), m_fd, PathRedirection::Write));
|
||||
return make_ref_counted<CommandValue>(move(command));
|
||||
|
@ -3724,7 +3724,7 @@ String TildeValue::resolve_as_string(RefPtr<Shell> shell)
|
|||
Vector<String> TildeValue::resolve_as_list(RefPtr<Shell> shell)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.append("~");
|
||||
builder.append('~');
|
||||
builder.append(m_username);
|
||||
|
||||
if (!shell)
|
||||
|
|
|
@ -207,11 +207,11 @@ int Shell::builtin_type(int argc, char const** argv)
|
|||
if (!dont_show_function_source) {
|
||||
StringBuilder builder;
|
||||
builder.append(fn.name);
|
||||
builder.append("(");
|
||||
builder.append('(');
|
||||
for (size_t i = 0; i < fn.arguments.size(); i++) {
|
||||
builder.append(fn.arguments[i]);
|
||||
if (!(i == fn.arguments.size() - 1))
|
||||
builder.append(" ");
|
||||
builder.append(' ');
|
||||
}
|
||||
builder.append(") {\n"sv);
|
||||
if (fn.body) {
|
||||
|
@ -448,7 +448,7 @@ int Shell::builtin_export(int argc, char const** argv)
|
|||
if (value) {
|
||||
auto values = value->resolve_as_list(*this);
|
||||
StringBuilder builder;
|
||||
builder.join(" ", values);
|
||||
builder.join(' ', values);
|
||||
parts.append(builder.to_string());
|
||||
} else {
|
||||
// Ignore the export.
|
||||
|
|
|
@ -41,7 +41,7 @@ String Formatter::format()
|
|||
|
||||
auto string = current_builder().string_view();
|
||||
|
||||
if (!string.ends_with(" "))
|
||||
if (!string.ends_with(' '))
|
||||
current_builder().append(m_trivia);
|
||||
|
||||
return current_builder().to_string();
|
||||
|
|
|
@ -1969,7 +1969,7 @@ RefPtr<AST::Node> Parser::parse_glob()
|
|||
textbuilder.append(bareword->text());
|
||||
} else if (glob_after->is_tilde()) {
|
||||
auto bareword = static_cast<AST::Tilde*>(glob_after.ptr());
|
||||
textbuilder.append("~");
|
||||
textbuilder.append('~');
|
||||
textbuilder.append(bareword->text());
|
||||
} else {
|
||||
return create<AST::SyntaxError>(String::formatted("Invalid node '{}' in glob position, escape shell special characters", glob_after->class_name()));
|
||||
|
|
|
@ -390,7 +390,7 @@ String Shell::local_variable_or(StringView name, String const& replacement) cons
|
|||
auto value = lookup_local_variable(name);
|
||||
if (value) {
|
||||
StringBuilder builder;
|
||||
builder.join(" ", value->resolve_as_list(*this));
|
||||
builder.join(' ', value->resolve_as_list(*this));
|
||||
return builder.to_string();
|
||||
}
|
||||
return replacement;
|
||||
|
@ -839,7 +839,7 @@ ErrorOr<RefPtr<Job>> Shell::run_command(const AST::Command& command)
|
|||
close(sync_pipe[1]);
|
||||
|
||||
StringBuilder cmd;
|
||||
cmd.join(" ", command.argv);
|
||||
cmd.join(' ', command.argv);
|
||||
|
||||
auto command_copy = AST::Command(command);
|
||||
// Clear the next chain if it's to be immediately executed
|
||||
|
|
|
@ -128,7 +128,7 @@ private:
|
|||
span.attributes.color = m_palette.syntax_keyword();
|
||||
span.attributes.bold = true;
|
||||
m_is_first_in_command = false;
|
||||
} else if (node->text().starts_with("-")) {
|
||||
} else if (node->text().starts_with('-')) {
|
||||
span.attributes.color = m_palette.syntax_preprocessor_statement();
|
||||
} else {
|
||||
span.attributes.color = m_palette.base_text();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue