diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-02-20 03:02:23 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-02-20 03:02:23 +0400 |
commit | a70925317e24ccd932411e170fd305c8d0080c83 (patch) | |
tree | caa4cc2559630b2e00de987ad55cd82612ef7606 /mert/Util.cpp | |
parent | 5d1cfa0ebb164ed8d709c9d6e02f36dfb3134087 (diff) |
Put global variables in mert/util.cpp in anonymous space.
We do not allow clients to access the following variables.
Instead, use the APIs which we provide for that.
Also, remove the unused function, and fix smoke tests.
Diffstat (limited to 'mert/Util.cpp')
-rw-r--r-- | mert/Util.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/mert/Util.cpp b/mert/Util.cpp index 63b10d7be..5142b526a 100644 --- a/mert/Util.cpp +++ b/mert/Util.cpp @@ -11,29 +11,28 @@ using namespace std; -// global variables -Timer g_timer; - -int verbose = 0; - namespace { +Timer g_timer; +int g_verbose = 0; + bool FindDelimiter(const std::string &str, const std::string &delim, size_t *pos) { *pos = str.find(delim); return *pos != std::string::npos ? true : false; } + } // namespace int verboselevel() { - return verbose; + return g_verbose; } int setverboselevel(int v) { - verbose = v; - return verbose; + g_verbose = v; + return g_verbose; } size_t getNextPound(std::string &str, std::string &substr, @@ -73,22 +72,6 @@ void Tokenize(const char *str, const char delim, } } -int swapbytes(char *p, int sz, int n) -{ - char c, *l, *h; - - if((n < 1) || (sz < 2)) return 0; - for (; n--; p += sz) { - for (h = (l = p) + sz; --h > l; l++) { - c = *h; - *h = *l; - *l = c; - } - } - return 0; - -} - void ResetUserTime() { g_timer.start(); |