Remove all non const reference parameters
This commit is contained in:
parent
a411e43484
commit
661314cf4e
20 changed files with 37 additions and 37 deletions
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
namespace tree_sitter {
|
||||
namespace generate_code {
|
||||
static void str_replace(string &input, const string &search, const string &replace) {
|
||||
static void str_replace(string *input, const string &search, const string &replace) {
|
||||
size_t pos = 0;
|
||||
while (1) {
|
||||
pos = input.find(search, pos);
|
||||
pos = input->find(search, pos);
|
||||
if (pos == string::npos) break;
|
||||
input.erase(pos, search.length());
|
||||
input.insert(pos, replace);
|
||||
input->erase(pos, search.length());
|
||||
input->insert(pos, replace);
|
||||
pos += replace.length();
|
||||
}
|
||||
}
|
||||
|
|
@ -30,12 +30,12 @@ namespace tree_sitter {
|
|||
|
||||
string indent(string input) {
|
||||
string tab = " ";
|
||||
str_replace(input, "\n", "\n" + tab);
|
||||
str_replace(&input, "\n", "\n" + tab);
|
||||
return tab + input;
|
||||
}
|
||||
|
||||
string escape_string(string input) {
|
||||
str_replace(input, "\"", "\\\"");
|
||||
str_replace(&input, "\"", "\\\"");
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue