X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fhashcomp.cpp;h=e0347421b29d01fb89e7cedd13d89aacde04fb74;hb=e6601069038c35c546fd3f3dce95024b0d13f1b4;hp=8c34c8a5603984f9f1a5cc5731beb73200ec5d17;hpb=fcacc8e0306382bc3f938073092c3729d77e2b41;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 8c34c8a56..e0347421b 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -127,15 +127,12 @@ void nspace::strlower(char *n) } } -#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED) - size_t nspace::hash_compare >::operator()(const std::string &s) const +#ifdef HASHMAP_DEPRECATED + size_t CoreExport nspace::insensitive::operator()(const std::string &s) const #else - #ifdef HASHMAP_DEPRECATED - size_t CoreExport nspace::insensitive::operator()(const std::string &s) const - #else - size_t nspace::hash::operator()(const std::string &s) const - #endif + size_t nspace::hash::operator()(const std::string &s) const #endif + { /* XXX: NO DATA COPIES! :) * The hash function here is practically @@ -143,20 +140,16 @@ void nspace::strlower(char *n) * only with *x replaced with national_case_insensitive_map[*x]. * This avoids a copy to use hash */ - register size_t t = 0; + size_t t = 0; for (std::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */ t = 5 * t + national_case_insensitive_map[(unsigned char)*x]; return t; } -#if defined(WINDOWS) && !defined(HASHMAP_DEPRECATED) - size_t nspace::hash_compare >::operator()(const irc::string &s) const -#else - size_t CoreExport irc::hash::operator()(const irc::string &s) const -#endif +size_t CoreExport irc::hash::operator()(const irc::string &s) const { - register size_t t = 0; + size_t t = 0; for (irc::string::const_iterator x = s.begin(); x != s.end(); ++x) /* ++x not x++, as its faster */ t = 5 * t + national_case_insensitive_map[(unsigned char)*x]; return t; @@ -333,7 +326,7 @@ bool irc::sepstream::GetToken(std::string &token) n++; } - token = ""; + token.clear(); return false; } @@ -451,7 +444,7 @@ int irc::modestacker::GetStackedLine(std::vector &result, int max_l irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector &sequence, int begin, int end) { if (end < begin) - throw "stringjoiner logic error, this causes problems."; + return; // nothing to do here for (int v = begin; v < end; v++) joined.append(sequence[v]).append(seperator); @@ -461,7 +454,7 @@ irc::stringjoiner::stringjoiner(const std::string &seperator, const std::vector< irc::stringjoiner::stringjoiner(const std::string &seperator, const std::deque &sequence, int begin, int end) { if (end < begin) - throw "stringjoiner logic error, this causes problems."; + return; // nothing to do here for (int v = begin; v < end; v++) joined.append(sequence[v]).append(seperator); @@ -471,7 +464,7 @@ irc::stringjoiner::stringjoiner(const std::string &seperator, const std::dequeGetToken(x); + sep.GetToken(x); if (x.empty()) return 0; while (Overlaps(atoi(x.c_str()))) { - if (!sep->GetToken(x)) + if (!sep.GetToken(x)) return 0; }