Remove unused code, some string_view

This commit is contained in:
Henrik Rydgård
2024-05-05 11:58:35 +02:00
parent dae44c1120
commit e5178d2bc4
3 changed files with 6 additions and 36 deletions
+4 -4
View File
@@ -334,7 +334,7 @@ void SplitString(std::string_view str, const char delim, std::vector<std::string
}
}
static std::string ApplyHtmlEscapes(std::string str) {
static std::string ApplyHtmlEscapes(std::string_view str_view) {
struct Repl {
const char *a;
const char *b;
@@ -345,15 +345,15 @@ static std::string ApplyHtmlEscapes(std::string str) {
// Easy to add more cases.
};
std::string str(str_view);
for (const Repl &r : replacements) {
str = ReplaceAll(str, r.a, r.b);
}
return str;
}
// Meant for HTML listings and similar, so supports some HTML escapes.
void GetQuotedStrings(const std::string& str, std::vector<std::string> &output) {
void GetQuotedStrings(std::string_view str, std::vector<std::string> &output) {
size_t next = 0;
bool even = 0;
for (size_t pos = 0, len = str.length(); pos < len; ++pos) {
@@ -372,11 +372,11 @@ void GetQuotedStrings(const std::string& str, std::vector<std::string> &output)
}
}
// TODO: this is quite inefficient.
std::string ReplaceAll(std::string_view input, std::string_view src, std::string_view dest) {
size_t pos = 0;
std::string result(input);
if (src == dest)
return result;