summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-07-22 21:33:07 +0200
committerLioncash <mathew1800@gmail.com>2018-07-22 21:35:48 +0200
commitcd46b267f5715c0900b409d7bcb97f6bc9a43d9e (patch)
tree6c97e3a7e2727ebbbb84af10b16d1902ff0d283d /src
parentMerge pull request #773 from Subv/gl_ext_check (diff)
downloadyuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.tar
yuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.tar.gz
yuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.tar.bz2
yuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.tar.lz
yuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.tar.xz
yuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.tar.zst
yuzu-cd46b267f5715c0900b409d7bcb97f6bc9a43d9e.zip
Diffstat (limited to 'src')
-rw-r--r--src/common/string_util.cpp13
-rw-r--r--src/common/string_util.h2
2 files changed, 7 insertions, 8 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) {
diff --git a/src/common/string_util.h b/src/common/string_util.h
index daa071f83..4a2143b59 100644
--- a/src/common/string_util.h
+++ b/src/common/string_util.h
@@ -57,7 +57,7 @@ static bool TryParse(const std::string& str, N* const output) {
return false;
}
-std::string TabsToSpaces(int tab_size, const std::string& in);
+std::string TabsToSpaces(int tab_size, std::string in);
void SplitString(const std::string& str, char delim, std::vector<std::string>& output);