summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-01-28 23:09:25 -0500
committerAdam <Adam@anope.org>2011-01-28 23:09:25 -0500
commite62664138b42437186669952a5c1a848c2cdfb02 (patch)
tree803ca8c6ba64bcaf1ed70fbcfac41878f1204063 /src
parent3eadc1509f378f26037dd3b7e1d61e0ac2d35019 (diff)
Added patricia_tree::iterator
Diffstat (limited to 'src')
-rw-r--r--src/botserv.cpp2
-rw-r--r--src/init.cpp2
-rw-r--r--src/logger.cpp2
-rw-r--r--src/main.cpp22
-rw-r--r--src/modes.cpp2
-rw-r--r--src/operserv.cpp14
-rw-r--r--src/servers.cpp7
-rw-r--r--src/sessions.cpp2
-rw-r--r--src/users.cpp2
9 files changed, 34 insertions, 21 deletions
diff --git a/src/botserv.cpp b/src/botserv.cpp
index fac49761d..8c99cd2c4 100644
--- a/src/botserv.cpp
+++ b/src/botserv.cpp
@@ -34,7 +34,7 @@ void get_botserv_stats(long *nrec, long *memuse)
{
long count = 0, mem = 0;
- for (patricia_tree<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
{
BotInfo *bi = *it;
diff --git a/src/init.cpp b/src/init.cpp
index fc53d6a2b..6ee84478a 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -57,7 +57,7 @@ void introduce_user(const Anope::string &user)
}
/* We make the bots go online */
- for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
+ for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
{
User *u = *it;
diff --git a/src/logger.cpp b/src/logger.cpp
index 8198e29a2..191f977d4 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -36,7 +36,7 @@ void InitLogChannels(ServerConfig *config)
c->SetFlag(CH_LOGCHAN);
c->SetFlag(CH_PERSIST);
- for (patricia_tree<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
{
BotInfo *bi = *it;
diff --git a/src/main.cpp b/src/main.cpp
index 96488189f..c59fe7829 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -172,9 +172,11 @@ void do_restart_services()
if (quitmsg.empty())
quitmsg = "Restarting";
/* Send a quit for all of our bots */
- for (patricia_tree<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick);
+ for (bool next = it.next(); next;)
{
BotInfo *bi = *it;
+ next = it.next();
/* Don't use quitmsg here, it may contain information you don't want people to see */
ircdproto->SendQuit(bi, "Restarting");
@@ -214,9 +216,11 @@ static void services_shutdown()
if (started && UplinkSock)
{
/* Send a quit for all of our bots */
- for (patricia_tree<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick);
+ for (bool next = it.next(); next;)
{
BotInfo *bi = *it;
+ next = it.next();
/* Don't use quitmsg here, it may contain information you don't want people to see */
ircdproto->SendQuit(bi, "Shutting down");
@@ -228,8 +232,13 @@ static void services_shutdown()
ircdproto->SendSquit(Config->ServerName, quitmsg);
- while (!UserListByNick.empty())
- delete UserListByNick.front();
+ patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
+ for (bool next = uit.next(); next;)
+ {
+ User *u = *uit;
+ next = uit.next();
+ delete u;
+ }
}
SocketEngine->Process();
delete UplinkSock;
@@ -497,10 +506,11 @@ int main(int ac, char **av, char **envp)
FOREACH_MOD(I_OnServerDisconnect, OnServerDisconnect());
/* Clear all of our users, but not our bots */
- for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end;)
+ patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick);
+ for (bool next = it.next(); next;)
{
User *u = *it;
- ++it;
+ next = it.next();
if (u->server != Me)
delete u;
diff --git a/src/modes.cpp b/src/modes.cpp
index bc870cb1b..3a79409a6 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -78,7 +78,7 @@ void SetDefaultMLock(ServerConfig *config)
}
/* Apply the new modes to channels */
- for (patricia_tree<BotInfo *>::const_iterator it = BotListByNick.begin(), it_end = BotListByNick.end(); it != it_end; ++it)
+ for (patricia_tree<BotInfo *, ci::ci_char_traits>::iterator it(BotListByNick); it.next();)
{
BotInfo *bi = *it;
diff --git a/src/operserv.cpp b/src/operserv.cpp
index 610d24e61..c08a0e53d 100644
--- a/src/operserv.cpp
+++ b/src/operserv.cpp
@@ -599,10 +599,11 @@ XLine *SNLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_
{
Anope::string rreason = "G-Lined: " + reason;
- for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end;)
+ patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
+ for (bool next = uit.next(); next;)
{
- User *user = *it;
- ++it;
+ User *user = *uit;
+ next = uit.next();
if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->realname, x->Mask))
kill_user(Config->ServerName, user, rreason);
@@ -729,10 +730,11 @@ XLine *SQLineManager::Add(BotInfo *bi, User *u, const Anope::string &mask, time_
}
else
{
- for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end;)
+ patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
+ for (bool next = uit.next(); next;)
{
- User *user = *it;
- ++it;
+ User *user = *uit;
+ next = uit.next();
if (!user->HasMode(UMODE_OPER) && user->server != Me && Anope::Match(user->nick, x->Mask))
kill_user(Config->ServerName, user, rreason);
diff --git a/src/servers.cpp b/src/servers.cpp
index 47a5e5389..ada6a8632 100644
--- a/src/servers.cpp
+++ b/src/servers.cpp
@@ -85,10 +85,11 @@ Server::~Server()
if (Capab.HasFlag(CAPAB_NOQUIT) || Capab.HasFlag(CAPAB_QS))
{
- for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end;)
+ patricia_tree<User *, ci::ci_char_traits>::iterator uit(UserListByNick);
+ for (bool next = uit.next(); next;)
{
- User *u = *it;
- ++it;
+ User *u = *uit;
+ next = uit.next();
if (u->server == this)
{
diff --git a/src/sessions.cpp b/src/sessions.cpp
index aa5627529..7ff165346 100644
--- a/src/sessions.cpp
+++ b/src/sessions.cpp
@@ -53,7 +53,7 @@ void get_session_stats(long &count, long &mem)
count = SessionList.size();
mem = sizeof(Session) * SessionList.size();
- for (patricia_tree<Session *>::const_iterator it = SessionList.begin(), it_end = SessionList.end(); it != it_end; ++it)
+ for (patricia_tree<Session *>::iterator it(SessionList); it.next();)
{
Session *session = *it;
diff --git a/src/users.cpp b/src/users.cpp
index 488f143c8..970b70c64 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -682,7 +682,7 @@ void get_user_stats(long &count, long &mem)
{
count = mem = 0;
- for (patricia_tree<User *>::const_iterator it = UserListByNick.begin(), it_end = UserListByNick.end(); it != it_end; ++it)
+ for (patricia_tree<User *, ci::ci_char_traits>::iterator it(UserListByNick); it.next();)
{
User *user = *it;