mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 06:57:45 +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
|
@ -94,7 +94,7 @@ bool Debugger::set_execution_position(String const& file, size_t line)
|
|||
|
||||
Debug::DebugInfo::SourcePosition Debugger::create_source_position(String const& file, size_t line)
|
||||
{
|
||||
if (file.starts_with("/"))
|
||||
if (file.starts_with('/'))
|
||||
return { file, line + 1 };
|
||||
return { LexicalPath::canonicalized_path(String::formatted("{}/{}", m_source_root, file)), line + 1 };
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ Optional<String> NewProjectDialog::get_available_project_name()
|
|||
Optional<String> NewProjectDialog::get_project_full_path()
|
||||
{
|
||||
// Do not permit forward-slashes in project names
|
||||
if (m_name_input->text().contains("/"))
|
||||
if (m_name_input->text().contains('/'))
|
||||
return {};
|
||||
|
||||
auto create_in = m_create_in_input->text();
|
||||
|
|
|
@ -619,7 +619,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_copy_relative_path_action()
|
|||
auto copy_relative_path_action = GUI::Action::create("Copy &Relative Path", [this](const GUI::Action&) {
|
||||
auto paths = selected_file_paths();
|
||||
VERIFY(!paths.is_empty());
|
||||
auto paths_string = String::join("\n", paths);
|
||||
auto paths_string = String::join('\n', paths);
|
||||
GUI::Clipboard::the().set_plain_text(paths_string);
|
||||
});
|
||||
copy_relative_path_action->set_enabled(true);
|
||||
|
@ -636,7 +636,7 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_copy_full_path_action()
|
|||
Vector<String> full_paths;
|
||||
for (auto& path : paths)
|
||||
full_paths.append(get_absolute_path(path));
|
||||
auto paths_string = String::join("\n", full_paths);
|
||||
auto paths_string = String::join('\n', full_paths);
|
||||
GUI::Clipboard::the().set_plain_text(paths_string);
|
||||
});
|
||||
copy_full_path_action->set_enabled(true);
|
||||
|
@ -1086,7 +1086,7 @@ String HackStudioWidget::get_full_path_of_serenity_source(String const& file)
|
|||
path_parts.remove(0);
|
||||
}
|
||||
StringBuilder relative_path_builder;
|
||||
relative_path_builder.join("/", path_parts);
|
||||
relative_path_builder.join('/', path_parts);
|
||||
constexpr char SERENITY_LIBS_PREFIX[] = "/usr/src/serenity";
|
||||
LexicalPath serenity_sources_base(SERENITY_LIBS_PREFIX);
|
||||
return String::formatted("{}/{}", serenity_sources_base, relative_path_builder.to_string());
|
||||
|
|
|
@ -15,7 +15,7 @@ Language language_from_file(LexicalPath const& file)
|
|||
return Language::GitCommit;
|
||||
|
||||
auto extension = file.extension();
|
||||
VERIFY(!extension.starts_with("."));
|
||||
VERIFY(!extension.starts_with('.'));
|
||||
if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++"
|
||||
|| extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++")
|
||||
return Language::Cpp;
|
||||
|
@ -57,7 +57,7 @@ String language_name_from_file(LexicalPath const& file)
|
|||
return "GitCommit";
|
||||
|
||||
auto extension = file.extension();
|
||||
VERIFY(!extension.starts_with("."));
|
||||
VERIFY(!extension.starts_with('.'));
|
||||
if (extension == "c" || extension == "cc" || extension == "cxx" || extension == "cpp" || extension == "c++"
|
||||
|| extension == "h" || extension == "hh" || extension == "hxx" || extension == "hpp" || extension == "h++")
|
||||
return "C++";
|
||||
|
|
|
@ -246,7 +246,7 @@ void ProjectBuilder::for_each_library_dependencies(Function<void(String, Vector<
|
|||
auto library_name = result.capture_group_matches.at(0).at(0).view.string_view();
|
||||
auto dependencies_string = result.capture_group_matches.at(0).at(1).view.string_view();
|
||||
|
||||
func(library_name, dependencies_string.split_view(" "));
|
||||
func(library_name, dependencies_string.split_view(' '));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ static void update_path_environment_variable()
|
|||
path.append({ path_env_ptr, strlen(path_env_ptr) });
|
||||
|
||||
if (path.length())
|
||||
path.append(":");
|
||||
path.append(':');
|
||||
path.append("/usr/local/sbin:/usr/local/bin:/usr/bin:/bin"sv);
|
||||
setenv("PATH", path.to_string().characters(), true);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue