Remove all non const reference parameters

This commit is contained in:
Max Brunsfeld 2014-03-09 22:21:58 -07:00
parent a411e43484
commit 661314cf4e
20 changed files with 37 additions and 37 deletions

View file

@ -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;
}
}