mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
AK: Remove StringBuilder::build() in favor of to_deprecated_string()
Having an alias function that only wraps another one is silly, and keeping the more obvious name should flush out more uses of deprecated strings. No behavior change.
This commit is contained in:
parent
da81041e97
commit
6e7459322d
129 changed files with 213 additions and 219 deletions
|
@ -54,7 +54,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
if (num_added > 1)
|
||||
sb.appendff(",{}", target_start + num_added - 1);
|
||||
|
||||
outln("Hunk: {}", sb.build());
|
||||
outln("Hunk: {}", sb.to_deprecated_string());
|
||||
for (auto const& line : hunk.removed_lines) {
|
||||
if (color_output)
|
||||
outln("\033[31;1m< {}\033[0m", line);
|
||||
|
|
|
@ -94,7 +94,7 @@ static DeprecatedString interpret_backslash_escapes(StringView string, bool& no_
|
|||
}
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
|
|
@ -421,7 +421,7 @@ private:
|
|||
for (auto& e : match.capture_group_matches[0])
|
||||
result.append(e.view.string_view());
|
||||
|
||||
return result.build();
|
||||
return result.to_deprecated_string();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ static DeprecatedString prompt_for_level(int level)
|
|||
for (auto i = 0; i < level; ++i)
|
||||
prompt_builder.append(" "sv);
|
||||
|
||||
return prompt_builder.build();
|
||||
return prompt_builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
static DeprecatedString read_next_piece()
|
||||
|
|
|
@ -565,28 +565,28 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
} else if (sequence == "j" || sequence == "\e[B" || sequence == "\n") {
|
||||
if (!emulate_more) {
|
||||
if (!modifier_buffer.is_empty())
|
||||
pager.down_n(modifier_buffer.build().to_uint().value_or(1));
|
||||
pager.down_n(modifier_buffer.to_deprecated_string().to_uint().value_or(1));
|
||||
else
|
||||
pager.down();
|
||||
}
|
||||
} else if (sequence == "k" || sequence == "\e[A") {
|
||||
if (!emulate_more) {
|
||||
if (!modifier_buffer.is_empty())
|
||||
pager.up_n(modifier_buffer.build().to_uint().value_or(1));
|
||||
pager.up_n(modifier_buffer.to_deprecated_string().to_uint().value_or(1));
|
||||
else
|
||||
pager.up();
|
||||
}
|
||||
} else if (sequence == "g") {
|
||||
if (!emulate_more) {
|
||||
if (!modifier_buffer.is_empty())
|
||||
pager.go_to_line(modifier_buffer.build().to_uint().value());
|
||||
pager.go_to_line(modifier_buffer.to_deprecated_string().to_uint().value());
|
||||
else
|
||||
pager.top();
|
||||
}
|
||||
} else if (sequence == "G") {
|
||||
if (!emulate_more) {
|
||||
if (!modifier_buffer.is_empty())
|
||||
pager.go_to_line(modifier_buffer.build().to_uint().value());
|
||||
pager.go_to_line(modifier_buffer.to_deprecated_string().to_uint().value());
|
||||
else
|
||||
pager.bottom();
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ public:
|
|||
StringCollector() = default;
|
||||
virtual ~StringCollector() = default;
|
||||
|
||||
DeprecatedString build() { return m_builder.build(); }
|
||||
DeprecatedString build() { return m_builder.to_deprecated_string(); }
|
||||
|
||||
static DeprecatedString from(Markdown::Heading const& heading)
|
||||
{
|
||||
|
|
|
@ -63,7 +63,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
auto& part = parts[idx];
|
||||
|
||||
path_builder.append(part);
|
||||
auto path = path_builder.build();
|
||||
auto path = path_builder.to_deprecated_string();
|
||||
|
||||
struct stat st;
|
||||
if (stat(path.characters(), &st) < 0) {
|
||||
|
|
|
@ -252,7 +252,7 @@ static DeprecatedString handle_escapes(char const* string)
|
|||
builder.append('\b');
|
||||
break;
|
||||
case 'c':
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
case 'e':
|
||||
builder.append('\e');
|
||||
break;
|
||||
|
@ -288,7 +288,7 @@ static DeprecatedString handle_escapes(char const* string)
|
|||
}
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
|
|
|
@ -87,7 +87,7 @@ public:
|
|||
m_sql_client->on_next_result = [](auto, auto, auto row) {
|
||||
StringBuilder builder;
|
||||
builder.join(", "sv, row);
|
||||
outln("{}", builder.build());
|
||||
outln("{}", builder.to_deprecated_string());
|
||||
};
|
||||
|
||||
m_sql_client->on_results_exhausted = [this](auto, auto, auto total_rows) {
|
||||
|
@ -299,7 +299,7 @@ private:
|
|||
for (auto i = 0; i < level; ++i)
|
||||
prompt_builder.append(" "sv);
|
||||
|
||||
return prompt_builder.build();
|
||||
return prompt_builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
bool handle_command(StringView command)
|
||||
|
|
|
@ -86,7 +86,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
line.append(ch);
|
||||
if (ch == '\n') {
|
||||
if (wanted_line_count > line_count || line_index >= line_count - wanted_line_count)
|
||||
out("{}", line.build());
|
||||
out("{}", line.to_deprecated_string());
|
||||
line_index++;
|
||||
line.clear();
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ static void print_directory_tree(DeprecatedString const& root_path, int depth, D
|
|||
builder.append('/');
|
||||
}
|
||||
builder.append(name);
|
||||
DeprecatedString full_path = builder.to_deprecated_string();
|
||||
auto full_path = builder.to_deprecated_string();
|
||||
|
||||
struct stat st;
|
||||
int rc = lstat(full_path.characters(), &st);
|
||||
|
|
|
@ -142,7 +142,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
builder.append("$5$"sv);
|
||||
builder.append(TRY(encode_base64({ random_data, sizeof(random_data) })));
|
||||
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
};
|
||||
|
||||
char* hash = crypt(password.characters(), TRY(get_salt()).characters());
|
||||
|
|
|
@ -34,7 +34,7 @@ static DeprecatedString build_header_string(Vector<char const*> const& command,
|
|||
builder.appendff("Every {}.{}s: \x1b[1m", interval.tv_sec, interval.tv_usec / 100000);
|
||||
builder.join(' ', command);
|
||||
builder.append("\x1b[0m"sv);
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
static DeprecatedString build_header_string(Vector<char const*> const& command, Vector<DeprecatedString> const& filenames)
|
||||
|
@ -43,7 +43,7 @@ static DeprecatedString build_header_string(Vector<char const*> const& command,
|
|||
builder.appendff("Every time any of {} changes: \x1b[1m", filenames);
|
||||
builder.join(' ', command);
|
||||
builder.append("\x1b[0m"sv);
|
||||
return builder.build();
|
||||
return builder.to_deprecated_string();
|
||||
}
|
||||
|
||||
static struct timeval get_current_time()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue