diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-04-28 13:48:57 +0200 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2014-05-09 16:45:57 +0200 |
commit | fdbd7075cab8d54f90c038e68afba868a9ff9f63 (patch) | |
tree | 4c80fd6e0cdd3e4d8370bb67a477da26c83dc6ce | |
parent | ee21912510275c7a0ebeafd2ff553c1db4a4f460 (diff) |
Remove unused function WildcardMatch
No longer necessary after implementing netmask-based matching.
Also remove a longer-unused function `skipspaces`.
-rw-r--r-- | src/test/util_tests.cpp | 11 | ||||
-rw-r--r-- | src/util.cpp | 37 | ||||
-rw-r--r-- | src/util.h | 9 |
3 files changed, 0 insertions, 57 deletions
diff --git a/src/test/util_tests.cpp b/src/test/util_tests.cpp index 7e7c05a59d..f4ca8c0539 100644 --- a/src/test/util_tests.cpp +++ b/src/test/util_tests.cpp @@ -165,17 +165,6 @@ BOOST_AUTO_TEST_CASE(util_GetArg) BOOST_CHECK_EQUAL(GetBoolArg("booltest4", false), true); } -BOOST_AUTO_TEST_CASE(util_WildcardMatch) -{ - BOOST_CHECK(WildcardMatch("127.0.0.1", "*")); - BOOST_CHECK(WildcardMatch("127.0.0.1", "127.*")); - BOOST_CHECK(WildcardMatch("abcdef", "a?cde?")); - BOOST_CHECK(!WildcardMatch("abcdef", "a?cde??")); - BOOST_CHECK(WildcardMatch("abcdef", "a*f")); - BOOST_CHECK(!WildcardMatch("abcdef", "a*x")); - BOOST_CHECK(WildcardMatch("", "*")); -} - BOOST_AUTO_TEST_CASE(util_FormatMoney) { BOOST_CHECK_EQUAL(FormatMoney(0, false), "0.00"); diff --git a/src/util.cpp b/src/util.cpp index 36ac23b1d5..00e29446d5 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -889,43 +889,6 @@ string DecodeBase32(const string& str) return string((const char*)&vchRet[0], vchRet.size()); } - -bool WildcardMatch(const char* psz, const char* mask) -{ - while (true) - { - switch (*mask) - { - case '\0': - return (*psz == '\0'); - case '*': - return WildcardMatch(psz, mask+1) || (*psz && WildcardMatch(psz+1, mask)); - case '?': - if (*psz == '\0') - return false; - break; - default: - if (*psz != *mask) - return false; - break; - } - psz++; - mask++; - } -} - -bool WildcardMatch(const string& str, const string& mask) -{ - return WildcardMatch(str.c_str(), mask.c_str()); -} - - - - - - - - static std::string FormatException(std::exception* pex, const char* pszThread) { #ifdef WIN32 diff --git a/src/util.h b/src/util.h index fa1e664c92..011a40e540 100644 --- a/src/util.h +++ b/src/util.h @@ -182,8 +182,6 @@ std::string DecodeBase32(const std::string& str); std::string EncodeBase32(const unsigned char* pch, size_t len); std::string EncodeBase32(const std::string& str); void ParseParameters(int argc, const char*const argv[]); -bool WildcardMatch(const char* psz, const char* mask); -bool WildcardMatch(const std::string& str, const std::string& mask); void FileCommit(FILE *fileout); bool TruncateFile(FILE *file, unsigned int length); int RaiseFileDescriptorLimit(int nMinFD); @@ -348,13 +346,6 @@ inline std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime) return pszTime; } -template<typename T> -void skipspaces(T& it) -{ - while (isspace(*it)) - ++it; -} - inline bool IsSwitchChar(char c) { #ifdef WIN32 |