summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/common/common.h6
-rw-r--r--src/common/string_util.cpp11
2 files changed, 8 insertions, 9 deletions
diff --git a/src/common/common.h b/src/common/common.h
index cb69eabe4..9f3016d34 100644
--- a/src/common/common.h
+++ b/src/common/common.h
@@ -20,11 +20,6 @@
#define STACKALIGN
-#if __cplusplus >= 201103L || defined(_MSC_VER) || defined(__GXX_EXPERIMENTAL_CXX0X__)
-#define HAVE_CXX11_SYNTAX 1
-#endif
-
-#if HAVE_CXX11_SYNTAX
// An inheritable class to disallow the copy constructor and operator= functions
class NonCopyable
{
@@ -36,7 +31,6 @@ private:
NonCopyable(NonCopyable&);
NonCopyable& operator=(NonCopyable& other);
};
-#endif
#include "common/log.h"
#include "common/common_types.h"
diff --git a/src/common/string_util.cpp b/src/common/string_util.cpp
index c1f22bda3..e78aed75d 100644
--- a/src/common/string_util.cpp
+++ b/src/common/string_util.cpp
@@ -283,12 +283,17 @@ std::string TabsToSpaces(int tab_size, const std::string &in)
std::string ReplaceAll(std::string result, const std::string& src, const std::string& dest)
{
- while(1)
+ size_t pos = 0;
+
+ if (src == dest)
+ return result;
+
+ while ((pos = result.find(src, pos)) != std::string::npos)
{
- size_t pos = result.find(src);
- if (pos == std::string::npos) break;
result.replace(pos, src.size(), dest);
+ pos += dest.length();
}
+
return result;
}