summaryrefslogtreecommitdiffstats
path: root/src/common/string_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/string_util.cpp')
-rw-r--r--src/common/string_util.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index f3ad3d68a..2099eebb8 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -168,15 +168,14 @@ void SplitString(const std::string& str, const char delim, std::vector<std::stri
output.pop_back();
}
-std::string TabsToSpaces(int tab_size, const std::string& in) {
- const std::string spaces(tab_size, ' ');
- std::string out(in);
-
+std::string TabsToSpaces(int tab_size, std::string in) {
size_t i = 0;
- while (out.npos != (i = out.find('\t')))
- out.replace(i, 1, spaces);
- return out;
+ while ((i = in.find('\t')) != std::string::npos) {
+ in.replace(i, 1, tab_size, ' ');
+ }
+
+ return in;
}
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest) {