mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 09:47:34 +00:00
Everywhere: Pass AK::StringView by value
This commit is contained in:
parent
ad5d217e76
commit
8b1108e485
392 changed files with 978 additions and 978 deletions
|
@ -119,7 +119,7 @@ public:
|
|||
And,
|
||||
Or,
|
||||
};
|
||||
static BooleanOperator op_from(const StringView& sv)
|
||||
static BooleanOperator op_from(StringView sv)
|
||||
{
|
||||
if (sv == "&")
|
||||
return BooleanOperator::And;
|
||||
|
@ -204,7 +204,7 @@ public:
|
|||
Greater,
|
||||
};
|
||||
|
||||
static ComparisonOperation op_from(const StringView& sv)
|
||||
static ComparisonOperation op_from(StringView sv)
|
||||
{
|
||||
if (sv == "<")
|
||||
return ComparisonOperation::Less;
|
||||
|
@ -274,7 +274,7 @@ public:
|
|||
Quotient,
|
||||
Remainder,
|
||||
};
|
||||
static ArithmeticOperation op_from(const StringView& sv)
|
||||
static ArithmeticOperation op_from(StringView sv)
|
||||
{
|
||||
if (sv == "+")
|
||||
return ArithmeticOperation::Sum;
|
||||
|
|
|
@ -9,9 +9,9 @@
|
|||
#include <LibGUI/GMLFormatter.h>
|
||||
#include <unistd.h>
|
||||
|
||||
bool format_file(const StringView&, bool);
|
||||
bool format_file(StringView, bool);
|
||||
|
||||
bool format_file(const StringView& path, bool inplace)
|
||||
bool format_file(StringView path, bool inplace)
|
||||
{
|
||||
auto read_from_stdin = path == "-";
|
||||
RefPtr<Core::File> file;
|
||||
|
|
|
@ -1308,7 +1308,7 @@ int main(int argc, char** argv)
|
|||
|
||||
Vector<Line::CompletionSuggestion> results;
|
||||
|
||||
Function<void(JS::Shape const&, StringView const&)> list_all_properties = [&results, &list_all_properties](JS::Shape const& shape, auto& property_pattern) {
|
||||
Function<void(JS::Shape const&, StringView)> list_all_properties = [&results, &list_all_properties](JS::Shape const& shape, auto property_pattern) {
|
||||
for (auto const& descriptor : shape.property_table()) {
|
||||
if (!descriptor.key.is_string())
|
||||
continue;
|
||||
|
|
|
@ -93,7 +93,7 @@ static Vector<String> wrap_line(Utf8View const& string, size_t width)
|
|||
|
||||
class Pager {
|
||||
public:
|
||||
Pager(StringView const& filename, FILE* file, FILE* tty, StringView const& prompt)
|
||||
Pager(StringView filename, FILE* file, FILE* tty, StringView prompt)
|
||||
: m_file(file)
|
||||
, m_tty(tty)
|
||||
, m_filename(filename)
|
||||
|
@ -264,7 +264,7 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
size_t render_status_line(StringView const& prompt, size_t off = 0, char end = '\0', bool ignored = false)
|
||||
size_t render_status_line(StringView prompt, size_t off = 0, char end = '\0', bool ignored = false)
|
||||
{
|
||||
for (; prompt[off] != end && off < prompt.length(); ++off) {
|
||||
if (ignored)
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
static int parse_options(const StringView& options)
|
||||
static int parse_options(StringView options)
|
||||
{
|
||||
int flags = 0;
|
||||
Vector<StringView> parts = options.split_view(',');
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// FIXME: Move this somewhere else when it's needed (e.g. in the Browser)
|
||||
class ContentDispositionParser {
|
||||
public:
|
||||
ContentDispositionParser(const StringView& value)
|
||||
ContentDispositionParser(StringView value)
|
||||
{
|
||||
GenericLexer lexer(value);
|
||||
|
||||
|
@ -84,8 +84,8 @@ public:
|
|||
FormData,
|
||||
};
|
||||
|
||||
const StringView& filename() const { return m_filename; }
|
||||
const StringView& name() const { return m_name; }
|
||||
StringView filename() const { return m_filename; }
|
||||
StringView name() const { return m_name; }
|
||||
Kind kind() const { return m_kind; }
|
||||
bool might_be_wrong() const { return m_might_be_wrong; }
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ Result<void, int> apply_stty_readable_modes(StringView mode_string, termios& t)
|
|||
warnln("Save string has an incorrect number of parameters");
|
||||
return 1;
|
||||
}
|
||||
auto parse_hex = [&](const StringView& v) {
|
||||
auto parse_hex = [&](StringView v) {
|
||||
tcflag_t ret = 0;
|
||||
for (auto c : v) {
|
||||
c = tolower(c);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
static bool s_set_variable = false;
|
||||
|
||||
static String get_variable(StringView const& name)
|
||||
static String get_variable(StringView name)
|
||||
{
|
||||
auto path = String::formatted("/proc/sys/{}", name);
|
||||
auto file = Core::File::construct(path);
|
||||
|
@ -26,7 +26,7 @@ static String get_variable(StringView const& name)
|
|||
return { (char const*)buffer.data(), buffer.size(), Chomp };
|
||||
}
|
||||
|
||||
static bool read_variable(StringView const& name)
|
||||
static bool read_variable(StringView name)
|
||||
{
|
||||
auto value = get_variable(name);
|
||||
if (value.is_null())
|
||||
|
@ -35,7 +35,7 @@ static bool read_variable(StringView const& name)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool write_variable(StringView const& name, StringView const& value)
|
||||
static bool write_variable(StringView name, StringView value)
|
||||
{
|
||||
auto old_value = get_variable(name);
|
||||
if (old_value.is_null())
|
||||
|
|
|
@ -316,7 +316,7 @@ private:
|
|||
|
||||
static OwnPtr<Condition> parse_complex_expression(char* argv[]);
|
||||
|
||||
static bool should_treat_expression_as_single_string(const StringView& arg_after)
|
||||
static bool should_treat_expression_as_single_string(StringView arg_after)
|
||||
{
|
||||
return arg_after.is_null() || arg_after == "-a" || arg_after == "-o";
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ static bool pre_interpret_hook(Wasm::Configuration& config, Wasm::InstructionPoi
|
|||
}
|
||||
}
|
||||
|
||||
static Optional<Wasm::Module> parse(StringView const& filename)
|
||||
static Optional<Wasm::Module> parse(StringView filename)
|
||||
{
|
||||
auto result = Core::File::open(filename, Core::OpenMode::ReadOnly);
|
||||
if (result.is_error()) {
|
||||
|
|
|
@ -27,9 +27,9 @@ bool read_items(FILE* fp, char entry_separator, Function<Decision(StringView)>);
|
|||
|
||||
class ParsedInitialArguments {
|
||||
public:
|
||||
ParsedInitialArguments(Vector<const char*>&, const StringView& placeholder);
|
||||
ParsedInitialArguments(Vector<const char*>&, StringView placeholder);
|
||||
|
||||
void for_each_joined_argument(const StringView&, Function<void(const String&)>) const;
|
||||
void for_each_joined_argument(StringView, Function<void(const String&)>) const;
|
||||
|
||||
size_t size() const { return m_all_parts.size(); }
|
||||
|
||||
|
@ -244,7 +244,7 @@ bool run_command(Vector<char*>&& child_argv, bool verbose, bool is_stdin, int de
|
|||
return true;
|
||||
}
|
||||
|
||||
ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, const StringView& placeholder)
|
||||
ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, StringView placeholder)
|
||||
{
|
||||
m_all_parts.ensure_capacity(arguments.size());
|
||||
bool some_argument_has_placeholder = false;
|
||||
|
@ -270,7 +270,7 @@ ParsedInitialArguments::ParsedInitialArguments(Vector<const char*>& arguments, c
|
|||
}
|
||||
}
|
||||
|
||||
void ParsedInitialArguments::for_each_joined_argument(const StringView& separator, Function<void(const String&)> callback) const
|
||||
void ParsedInitialArguments::for_each_joined_argument(StringView separator, Function<void(const String&)> callback) const
|
||||
{
|
||||
StringBuilder builder;
|
||||
for (auto& parts : m_all_parts) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue