mirror of
https://github.com/anope/anope.git
synced 2026-07-03 22:03:14 +02:00
Rewrote the hashing system to use std::tr1::unordered_map
This commit is contained in:
+6
-18
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user