diff options
| author | Adam <Adam@drink-coca-cola.info> | 2010-05-14 20:35:38 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2010-06-18 21:01:53 -0400 |
| commit | f049124905bd9f53439293e873003cb027a17b91 (patch) | |
| tree | 352ed9251fd47055dd770aa2d5eabb20247e4b43 /src/nickalias.cpp | |
| parent | 81a45520a773732c9f46785f27aa1956150775d7 (diff) | |
Rewrote the hashing system to use std::tr1::unordered_map
Diffstat (limited to 'src/nickalias.cpp')
| -rw-r--r-- | src/nickalias.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/nickalias.cpp b/src/nickalias.cpp index afd40ccd7..95d5bc4e9 100644 --- a/src/nickalias.cpp +++ b/src/nickalias.cpp @@ -1,31 +1,24 @@ #include "services.h" #include "modules.h" -#define HASH(nick) ((tolower((nick)[0])&31)<<5 | (tolower((nick)[1])&31)) - NickRequest::NickRequest(const std::string &nickname) { if (nickname.empty()) throw CoreException("Empty nick passed to NickRequest constructor"); - next = prev = NULL; email = NULL; requested = lastmail = 0; this->nick = sstrdup(nickname.c_str()); - insert_requestnick(this); // till this is destroyed / redone in STL + + NickRequestList[this->nick] = this; } NickRequest::~NickRequest() { FOREACH_MOD(I_OnDelNickRequest, OnDelNickRequest(this)); - if (this->next) - this->next->prev = this->prev; - if (this->prev) - this->prev->next = this->next; - else - nrlists[HASH(this->nick)] = this->next; + NickRequestList.erase(this->nick); if (this->nick) delete [] this->nick; @@ -44,14 +37,14 @@ NickAlias::NickAlias(const std::string &nickname, NickCore *nickcore) else if (!nickcore) throw CoreException("Empty nickcore passed to NickAlias constructor"); - next = prev = NULL; nick = last_quit = last_realname = last_usermask = NULL; time_registered = last_seen = 0; this->nick = sstrdup(nickname.c_str()); this->nc = nickcore; slist_add(&nc->aliases, this); - alpha_insert_alias(this); + + NickAliasList[this->nick] = this; for (std::list<std::pair<std::string, std::string> >::iterator it = Config.Opers.begin(); it != Config.Opers.end(); it++) { @@ -110,12 +103,7 @@ NickAlias::~NickAlias() } /* Remove us from the aliases list */ - if (this->next) - this->next->prev = this->prev; - if (this->prev) - this->prev->next = this->next; - else - nalists[HASH(this->nick)] = this->next; + NickAliasList.erase(this->nick); delete [] this->nick; if (this->last_usermask) |
