diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-15 22:58:24 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2005-05-15 22:58:24 +0000 |
commit | ab01aaeeee9aed655df2eec2522072233fe3aa57 (patch) | |
tree | ba5f3d6f130e6363491afe8d2d1808c8033a8878 | |
parent | a551203100f50ff4767d516566f38277bd268110 (diff) |
Changed to use __single_client_alloc, faster on most systems in a single thread
Specified namespace std in *all* files
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1404 e03df62e-2008-0410-955e-edbf42e46eb7
78 files changed, 200 insertions, 114 deletions
diff --git a/include/channels.h b/include/channels.h index 7df2d665e..7771c292d 100644 --- a/include/channels.h +++ b/include/channels.h @@ -84,15 +84,15 @@ class ModeParameter : public classbase /** Holds a complete ban list */ -typedef std::vector<BanItem> BanList; +typedef std::vector<BanItem, __single_client_alloc> BanList; /** Holds a complete exempt list */ -typedef std::vector<ExemptItem> ExemptList; +typedef std::vector<ExemptItem, __single_client_alloc> ExemptList; /** Holds a complete invite list */ -typedef std::vector<InviteItem> InviteList; +typedef std::vector<InviteItem, __single_client_alloc> InviteList; /** Holds all relevent information for a channel. * This class represents a channel, and contains its name, modes, time created, topic, topic set time, @@ -112,7 +112,7 @@ class chanrec : public Extensible /** User list (casted to char*'s to stop forward declaration stuff) * (chicken and egg scenario!) */ - std::vector<char*> internal_userlist; + std::vector<char*, __single_client_alloc> internal_userlist; /** Channel topic. * If this is an empty string, no channel topic is set. @@ -196,7 +196,7 @@ class chanrec : public Extensible * The resulting pointer to the vector should be considered * readonly and only modified via AddUser and DelUser. */ - std::vector<char*> *GetUsers(); + std::vector<char*, __single_client_alloc> *GetUsers(); /** Creates a channel record and initialises it with default values */ diff --git a/include/connection.h b/include/connection.h index b84d39df9..c92934c3f 100644 --- a/include/connection.h +++ b/include/connection.h @@ -110,7 +110,7 @@ class ircd_connector : public Extensible * So for A->B->C, if this was the record for B it would contain A and C * whilever both servers are connected to B. */ - std::vector<std::string> routes; + std::vector<std::string, __single_client_alloc> routes; /** Create an outbound connection to a listening socket @@ -273,7 +273,7 @@ class connection : public Extensible /** With a serverrec, this is a list of all established server connections. * With a userrec this is unused. */ - std::vector<ircd_connector> connectors; + std::vector<ircd_connector, __single_client_alloc> connectors; /** Default constructor */ diff --git a/include/message.h b/include/message.h index f6865453c..d00cae30e 100644 --- a/include/message.h +++ b/include/message.h @@ -31,8 +31,6 @@ int common_channels(userrec *u, userrec *u2); void chop(char* str); void tidystring(char* str); -void safedelete(chanrec *p); -void safedelete(userrec *p); void Blocking(int s); void NonBlocking(int s); int CleanAndResolve (char *resolvedHost, const char *unresolvedHost); diff --git a/include/modules.h b/include/modules.h index da2bfe023..26fea050d 100644 --- a/include/modules.h +++ b/include/modules.h @@ -69,7 +69,7 @@ typedef file_cache string_list; /** Holds a list of users in a channel */ -typedef std::deque<userrec*> chanuserlist; +typedef std::deque<userrec*, __single_client_alloc> chanuserlist; // This #define allows us to call a method in all diff --git a/include/users.h b/include/users.h index 2dda51984..7077aaa56 100644 --- a/include/users.h +++ b/include/users.h @@ -91,13 +91,13 @@ class ConnectClass : public classbase /** Holds a complete list of all channels to which a user has been invited and has not yet joined. */ -typedef std::vector<Invited> InvitedList; +typedef std::vector<Invited, __single_client_alloc> InvitedList; /** Holds a complete list of all allow and deny tags from the configuration file (connection classes) */ -typedef std::vector<ConnectClass> ClassVector; +typedef std::vector<ConnectClass, __single_client_alloc> ClassVector; /** Holds all information about a user * This class stores all information about a user connected to the irc server. Everything about a diff --git a/src/channels.cpp b/src/channels.cpp index 1904bfa26..4bbb69b9b 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -53,11 +55,9 @@ #define nspace std #endif -using namespace std; - extern int MODCOUNT; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; +extern std::vector<Module*, __single_client_alloc> modules; +extern std::vector<ircd_module*, __single_client_alloc> factory; extern int LogLevel; extern char ServerName[MAXBUF]; @@ -83,8 +83,7 @@ extern int NetBufferSize; int MaxWhoResults; extern time_t nb_start; -extern std::vector<int> fd_reap; -extern std::vector<std::string> module_names; +extern std::vector<std::string, __single_client_alloc> module_names; extern int boundPortCount; extern int portCount; @@ -103,7 +102,7 @@ extern time_t TIME; using namespace std; -std::vector<ModeParameter> custom_mode_params; +std::vector<ModeParameter, __single_client_alloc> custom_mode_params; chanrec::chanrec() { @@ -159,7 +158,7 @@ void chanrec::SetCustomModeParam(char mode,char* parameter,bool mode_on) { if (custom_mode_params.size()) { - for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) + for (vector<ModeParameter, __single_client_alloc>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) { if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) { @@ -183,7 +182,7 @@ std::string chanrec::GetModeParameter(char mode) { if (custom_mode_params.size()) { - for (vector<ModeParameter>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) + for (vector<ModeParameter, __single_client_alloc>::iterator i = custom_mode_params.begin(); i < custom_mode_params.end(); i++) { if ((i->mode == mode) && (!strcasecmp(this->name,i->channel))) { @@ -207,7 +206,7 @@ void chanrec::AddUser(char* castuser) void chanrec::DelUser(char* castuser) { - for (std::vector<char*>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++) + for (std::vector<char*, __single_client_alloc>::iterator a = internal_userlist.begin(); a < internal_userlist.end(); a++) { if (*a == castuser) { @@ -219,7 +218,7 @@ void chanrec::DelUser(char* castuser) log(DEBUG,"BUG BUG BUG! Attempt to remove an uncasted user from the internal list of %s!",name); } -std::vector<char*> *chanrec::GetUsers() +std::vector<char*, __single_client_alloc> *chanrec::GetUsers() { return &internal_userlist; } diff --git a/src/commands.cpp b/src/commands.cpp index d1d28bd56..e3ff3f74c 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -62,8 +64,6 @@ #include "helperfuncs.h" #include "hashcomp.h" -using namespace std; - #ifdef USE_KQUEUE extern int kq; #endif @@ -1033,7 +1033,7 @@ void handle_who(char **parameters, int pcnt, userrec *user) { if ((!strcmp(parameters[0],"0")) || (!strcmp(parameters[0],"*")) && (!strcmp(parameters[1],"o"))) { - for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector<userrec*, __single_client_alloc>::iterator i = all_opers.begin(); i != all_opers.end(); i++) { // If i were a rich man.. I wouldn't need to me making these bugfixes.. // But i'm a poor bastard with nothing better to do. @@ -2575,7 +2575,7 @@ void handle_amp(char token,char* params,serverrec* source,serverrec* reply, char { if (me[i] != NULL) { - for (vector<ircd_connector>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) + for (vector<ircd_connector, __single_client_alloc>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) { if (!strcasecmp(j->GetServerName().c_str(),params)) { diff --git a/src/connection.cpp b/src/connection.cpp index 384f626e2..b627c2494 100644 --- a/src/connection.cpp +++ b/src/connection.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <connection.h> #include <unistd.h> #include <fcntl.h> @@ -30,13 +32,11 @@ #include "inspstring.h" #include "helperfuncs.h" -using namespace std; - -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; +extern std::vector<Module*, __single_client_alloc> modules; +extern std::vector<ircd_module*, __single_client_alloc> factory; -std::deque<std::string> xsums; +std::deque<std::string, __single_client_alloc> xsums; extern int MODCOUNT; diff --git a/src/dns.cpp b/src/dns.cpp index 165e3100d..28b131586 100644 --- a/src/dns.cpp +++ b/src/dns.cpp @@ -17,6 +17,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define _DNS_C +using namespace std; + #include <string> #include <stdlib.h> #include <time.h> diff --git a/src/dynamic.cpp b/src/dynamic.cpp index 2aa309ad3..cc7aeb0b9 100644 --- a/src/dynamic.cpp +++ b/src/dynamic.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "globals.h" #include <dlfcn.h> #include "dynamic.h" diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index 70c592b1d..13e28ea15 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <string> #include "inspircd.h" #include "hashcomp.h" diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index c99ffdcf8..f418320e6 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -48,8 +50,6 @@ #include "helperfuncs.h" #include "hashcomp.h" -using namespace std; - extern int MODCOUNT; extern std::vector<Module*, __single_client_alloc> modules; @@ -283,7 +283,7 @@ void WriteChannel(chanrec* Ptr, userrec* user, char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - std::vector<char*> *ulist = Ptr->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = Ptr->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -310,7 +310,7 @@ void WriteChannelLocal(chanrec* Ptr, userrec* user, char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - std::vector<char*> *ulist = Ptr->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = Ptr->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -343,7 +343,7 @@ void WriteChannelWithServ(char* ServName, chanrec* Ptr, char* text, ...) va_end(argsPtr); - std::vector<char*> *ulist = Ptr->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = Ptr->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -369,7 +369,7 @@ void ChanExceptSender(chanrec* Ptr, userrec* user, char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - std::vector<char*> *ulist = Ptr->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = Ptr->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -428,7 +428,7 @@ void WriteCommon(userrec *u, char* text, ...) { if (u->chans[i].channel) { - std::vector<char*> *ulist = u->chans[i].channel->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = u->chans[i].channel->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -478,7 +478,7 @@ void WriteCommonExcept(userrec *u, char* text, ...) { if (u->chans[i].channel) { - std::vector<char*> *ulist = u->chans[i].channel->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = u->chans[i].channel->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -510,7 +510,7 @@ void WriteOpers(char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector<userrec*, __single_client_alloc>::iterator i = all_opers.begin(); i != all_opers.end(); i++) { userrec* a = *i; if ((a) && (a->fd != FD_MAGIC_NUMBER)) @@ -538,7 +538,7 @@ void NoticeAllOpers(userrec *source, bool local_only, char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - for (std::vector<userrec*>::iterator i = all_opers.begin(); i != all_opers.end(); i++) + for (std::vector<userrec*,__single_client_alloc>::iterator i = all_opers.begin(); i != all_opers.end(); i++) { userrec* a = *i; if ((a) && (a->fd != FD_MAGIC_NUMBER)) @@ -564,7 +564,7 @@ bool ChanAnyOnThisServer(chanrec *c,char* servername) { log(DEBUG,"ChanAnyOnThisServer"); - std::vector<char*> *ulist = c->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = c->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -585,7 +585,7 @@ bool CommonOnThisServer(userrec* u,const char* servername) { if (u->chans[i].channel) { - std::vector<char*> *ulist = u->chans[i].channel->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = u->chans[i].channel->GetUsers(); for (int j = 0; j < ulist->size(); j++) { char* o = (*ulist)[j]; @@ -1102,7 +1102,7 @@ void userlist(userrec *user,chanrec *c) snprintf(list,MAXBUF,"353 %s = %s :", user->nick, c->name); - std::vector<char*> *ulist = c->GetUsers(); + std::vector<char*, __single_client_alloc> *ulist = c->GetUsers(); for (int i = 0; i < ulist->size(); i++) { char* o = (*ulist)[i]; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index ccf91b6de..e077c939a 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -165,7 +165,7 @@ void AddOper(userrec* user) void DeleteOper(userrec* user) { - for (std::vector<userrec*>::iterator a = all_opers.begin(); a < all_opers.end(); a++) + for (std::vector<userrec*, __single_client_alloc>::iterator a = all_opers.begin(); a < all_opers.end(); a++) { if (*a == user) { @@ -385,10 +385,10 @@ void ReadConfig(bool bail, userrec* user) { log(DEFAULT,"Adding and removing modules due to rehash..."); - std::vector<std::string> old_module_names, new_module_names, added_modules, removed_modules; + std::vector<std::string, __single_client_alloc> old_module_names, new_module_names, added_modules, removed_modules; // store the old module names - for (std::vector<std::string>::iterator t = module_names.begin(); t != module_names.end(); t++) + for (std::vector<std::string, __single_client_alloc>::iterator t = module_names.begin(); t != module_names.end(); t++) { old_module_names.push_back(*t); } @@ -402,10 +402,10 @@ void ReadConfig(bool bail, userrec* user) // now create a list of new modules that are due to be loaded // and a seperate list of modules which are due to be unloaded - for (std::vector<std::string>::iterator _new = new_module_names.begin(); _new != new_module_names.end(); _new++) + for (std::vector<std::string, __single_client_alloc>::iterator _new = new_module_names.begin(); _new != new_module_names.end(); _new++) { bool added = true; - for (std::vector<std::string>::iterator old = old_module_names.begin(); old != old_module_names.end(); old++) + for (std::vector<std::string, __single_client_alloc>::iterator old = old_module_names.begin(); old != old_module_names.end(); old++) { if (*old == *_new) added = false; @@ -413,10 +413,10 @@ void ReadConfig(bool bail, userrec* user) if (added) added_modules.push_back(*_new); } - for (std::vector<std::string>::iterator oldm = old_module_names.begin(); oldm != old_module_names.end(); oldm++) + for (std::vector<std::string, __single_client_alloc>::iterator oldm = old_module_names.begin(); oldm != old_module_names.end(); oldm++) { bool removed = true; - for (std::vector<std::string>::iterator newm = new_module_names.begin(); newm != new_module_names.end(); newm++) + for (std::vector<std::string, __single_client_alloc>::iterator newm = new_module_names.begin(); newm != new_module_names.end(); newm++) { if (*newm == *oldm) removed = false; @@ -428,7 +428,7 @@ void ReadConfig(bool bail, userrec* user) // to be removed. int rem = 0, add = 0; if (!removed_modules.empty()) - for (std::vector<std::string>::iterator removing = removed_modules.begin(); removing != removed_modules.end(); removing++) + for (std::vector<std::string, __single_client_alloc>::iterator removing = removed_modules.begin(); removing != removed_modules.end(); removing++) { if (UnloadModule(removing->c_str())) { @@ -442,7 +442,7 @@ void ReadConfig(bool bail, userrec* user) } } if (!added_modules.empty()) - for (std::vector<std::string>::iterator adding = added_modules.begin(); adding != added_modules.end(); adding++) + for (std::vector<std::string, __single_client_alloc>::iterator adding = added_modules.begin(); adding != added_modules.end(); adding++) { if (LoadModule(adding->c_str())) { @@ -1668,7 +1668,7 @@ void DoSplitEveryone() { if (me[i] != NULL) { - for (vector<ircd_connector>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) + for (vector<ircd_connector, __single_client_alloc>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) { if (strcasecmp(j->GetServerName().c_str(),ServerName)) { @@ -2267,7 +2267,7 @@ void DoSplit(const char* params) { if (me[i] != NULL) { - for (vector<ircd_connector>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) + for (vector<ircd_connector, __single_client_alloc>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) { if (!strcasecmp(j->GetServerName().c_str(),params)) { @@ -2315,7 +2315,7 @@ void RemoveServer(const char* name) { if (me[i] != NULL) { - for (vector<ircd_connector>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) + for (vector<ircd_connector, __single_client_alloc>::iterator j = me[i]->connectors.begin(); j != me[i]->connectors.end(); j++) { if (!strcasecmp(j->GetServerName().c_str(),name)) { @@ -2342,7 +2342,7 @@ char* ModuleError() void erase_factory(int j) { int v = 0; - for (std::vector<ircd_module*>::iterator t = factory.begin(); t != factory.end(); t++) + for (std::vector<ircd_module*, __single_client_alloc>::iterator t = factory.begin(); t != factory.end(); t++) { if (v == j) { @@ -2357,7 +2357,7 @@ void erase_factory(int j) void erase_module(int j) { int v1 = 0; - for (std::vector<Module*>::iterator m = modules.begin(); m!= modules.end(); m++) + for (std::vector<Module*, __single_client_alloc>::iterator m = modules.begin(); m!= modules.end(); m++) { if (v1 == j) { @@ -2369,7 +2369,7 @@ void erase_module(int j) v1++; } int v2 = 0; - for (std::vector<std::string>::iterator v = module_names.begin(); v != module_names.end(); v++) + for (std::vector<std::string, __single_client_alloc>::iterator v = module_names.begin(); v != module_names.end(); v++) { if (v2 == j) { diff --git a/src/inspircd_io.cpp b/src/inspircd_io.cpp index fcbb83aae..43e0eec0b 100644 --- a/src/inspircd_io.cpp +++ b/src/inspircd_io.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <sys/time.h> #include <sys/resource.h> #include <sys/types.h> @@ -28,8 +30,6 @@ #include "inspstring.h" #include "helperfuncs.h" -using namespace std; - extern FILE *log_file; extern int boundPortCount; extern int openSockfd[MAXSOCKS]; diff --git a/src/inspircd_util.cpp b/src/inspircd_util.cpp index 6238a5cf4..e4c8d561d 100644 --- a/src/inspircd_util.cpp +++ b/src/inspircd_util.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" diff --git a/src/message.cpp b/src/message.cpp index 1aeee4ae4..4fc32f79b 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -46,11 +48,9 @@ #include "dns.h" #include "helperfuncs.h" -using namespace std; - extern int MODCOUNT; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; +extern std::vector<Module*, __single_client_alloc> modules; +extern std::vector<ircd_module*, __single_client_alloc> factory; extern char ServerName[MAXBUF]; @@ -89,36 +89,6 @@ int common_channels(userrec *u, userrec *u2) } -void safedelete(userrec *p) -{ - if (p) - { - log(DEBUG,"deleting %s %s %s %s",p->nick,p->ident,p->dhost,p->fullname); - log(DEBUG,"safedelete(userrec*): pointer is safe to delete"); - delete p; - p = NULL; - } - else - { - log(DEBUG,"safedelete(userrec*): unsafe pointer operation squished"); - } -} - -void safedelete(chanrec *p) -{ - if (p) - { - delete p; - p = NULL; - log(DEBUG,"safedelete(chanrec*): pointer is safe to delete"); - } - else - { - log(DEBUG,"safedelete(chanrec*): unsafe pointer operation squished"); - } -} - - void tidystring(char* str) { // strips out double spaces before a : parameter diff --git a/src/mode.cpp b/src/mode.cpp index 9af80bb00..285ec3e89 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -45,12 +47,10 @@ #include "inspstring.h" #include "helperfuncs.h" -using namespace std; - extern int MODCOUNT; -extern std::vector<Module*> modules; -extern std::vector<ircd_module*> factory; -extern std::vector<std::string> module_names; +extern std::vector<Module*, __single_client_alloc> modules; +extern std::vector<ircd_module*, __single_client_alloc> factory; +extern std::vector<std::string, __single_client_alloc> module_names; extern int LogLevel; diff --git a/src/modules.cpp b/src/modules.cpp index 63c764bbb..414cce617 100644 --- a/src/modules.cpp +++ b/src/modules.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -52,8 +54,6 @@ #include "helperfuncs.h" #include "hashcomp.h" -using namespace std; - #ifdef USE_KQUEUE extern int kq; #endif @@ -391,8 +391,8 @@ chanuserlist Server::GetUsers(chanrec* chan) { chanuserlist userl; userl.clear(); - std::vector<char*> *list = chan->GetUsers(); - for (std::vector<char*>::iterator i = list->begin(); i != list->end(); i++) + std::vector<char*, __single_client_alloc> *list = chan->GetUsers(); + for (std::vector<char*, __single_client_alloc>::iterator i = list->begin(); i != list->end(); i++) { char* o = *i; userl.push_back((userrec*)o); @@ -989,8 +989,8 @@ int FileReader::FileSize() } -std::vector<Module*> modules(255); -std::vector<ircd_module*> factory(255); +std::vector<Module*, __single_client_alloc> modules(255); +std::vector<ircd_module*, __single_client_alloc> factory(255); int MODCOUNT = -1; diff --git a/src/modules/extra/m_filter_pcre.cpp b/src/modules/extra/m_filter_pcre.cpp index 559bb686a..2619b7b21 100644 --- a/src/modules/extra/m_filter_pcre.cpp +++ b/src/modules/extra/m_filter_pcre.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + // Message and notice filtering using regex patterns // a module based on the original work done by Craig Edwards in 2003 // for the chatspike network. diff --git a/src/modules/extra/m_sql.cpp b/src/modules/extra/m_sql.cpp index 28d24bc48..d25af102a 100644 --- a/src/modules/extra/m_sql.cpp +++ b/src/modules/extra/m_sql.cpp @@ -14,6 +14,7 @@ * --------------------------------------------------- */ +using namespace std; #include <stdio.h> #include <string> diff --git a/src/modules/extra/m_sql.h b/src/modules/extra/m_sql.h index 5110146d9..fd02c456b 100644 --- a/src/modules/extra/m_sql.h +++ b/src/modules/extra/m_sql.h @@ -1,6 +1,8 @@ #ifndef __M_SQL_H__ #define __M_SQL_H__ +using namespace std; + #include <string> #include <vector> diff --git a/src/modules/extra/m_sqlauth.cpp b/src/modules/extra/m_sqlauth.cpp index 46721e098..16274de26 100644 --- a/src/modules/extra/m_sqlauth.cpp +++ b/src/modules/extra/m_sqlauth.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <stdlib.h> diff --git a/src/modules/extra/m_sqllog.cpp b/src/modules/extra/m_sqllog.cpp index 035012650..bffed5dd9 100644 --- a/src/modules/extra/m_sqllog.cpp +++ b/src/modules/extra/m_sqllog.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <stdlib.h> diff --git a/src/modules/extra/m_sqloper.cpp b/src/modules/extra/m_sqloper.cpp index 6ba379fac..51c26a749 100644 --- a/src/modules/extra/m_sqloper.cpp +++ b/src/modules/extra/m_sqloper.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <stdlib.h> diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index c12e367fd..b5f62f584 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "users.h" #include "channels.h" #include "modules.h" diff --git a/src/modules/m_antibottler.cpp b/src/modules/m_antibottler.cpp index 3b57d9d09..8351969e9 100644 --- a/src/modules/m_antibottler.cpp +++ b/src/modules/m_antibottler.cpp @@ -13,6 +13,7 @@ * * --------------------------------------------------- */ +using namespace std; #include "users.h" #include "channels.h" diff --git a/src/modules/m_blockcolor.cpp b/src/modules/m_blockcolor.cpp index 6ba86e595..13663cc40 100644 --- a/src/modules/m_blockcolor.cpp +++ b/src/modules/m_blockcolor.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <sstream> #include "users.h" diff --git a/src/modules/m_botmode.cpp b/src/modules/m_botmode.cpp index 69a9495a5..015677536 100644 --- a/src/modules/m_botmode.cpp +++ b/src/modules/m_botmode.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 64a01b8fc..697e8f5d4 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_chanfilter.cpp b/src/modules/m_chanfilter.cpp index c8896cf0a..1d10bcd08 100644 --- a/src/modules/m_chanfilter.cpp +++ b/src/modules/m_chanfilter.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <vector> diff --git a/src/modules/m_chanprotect.cpp b/src/modules/m_chanprotect.cpp index 66457b928..6314cca94 100644 --- a/src/modules/m_chanprotect.cpp +++ b/src/modules/m_chanprotect.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index 32d37f2a0..e1cc5a8cb 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_cloaking.cpp b/src/modules/m_cloaking.cpp index c6595eb6c..73b09b423 100644 --- a/src/modules/m_cloaking.cpp +++ b/src/modules/m_cloaking.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + // Hostname cloaking (+x mode) module for inspircd. // version 1.0.0.1 by brain (C. J. Edwards) Mar 2004. // diff --git a/src/modules/m_conn_lusers.cpp b/src/modules/m_conn_lusers.cpp index a16df4570..c0106566a 100644 --- a/src/modules/m_conn_lusers.cpp +++ b/src/modules/m_conn_lusers.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "users.h" #include "channels.h" #include "modules.h" diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 59a82d610..9995c1737 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + // Message and notice filtering using glob patterns // a module based on the original work done by Craig Edwards in 2003 // for the chatspike network. diff --git a/src/modules/m_foobar.cpp b/src/modules/m_foobar.cpp index dd6b73afb..81757799c 100644 --- a/src/modules/m_foobar.cpp +++ b/src/modules/m_foobar.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "users.h" #include "channels.h" #include "modules.h" diff --git a/src/modules/m_globops.cpp b/src/modules/m_globops.cpp index 1e37e1fb9..d3714a960 100644 --- a/src/modules/m_globops.cpp +++ b/src/modules/m_globops.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + // Globops and +g support module by C.J.Edwards #include <stdio.h> diff --git a/src/modules/m_helpop.cpp b/src/modules/m_helpop.cpp index bae4e73ae..bbc64b783 100644 --- a/src/modules/m_helpop.cpp +++ b/src/modules/m_helpop.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "users.h" #include "channels.h" #include "modules.h" diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index ffc9d3635..36cd3ea70 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 0e79cf496..6bbc58e97 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <stdlib.h> diff --git a/src/modules/m_knock.cpp b/src/modules/m_knock.cpp index 9553b619e..171e7045a 100644 --- a/src/modules/m_knock.cpp +++ b/src/modules/m_knock.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_nicklock.cpp b/src/modules/m_nicklock.cpp index 336a008c9..70fbcac62 100644 --- a/src/modules/m_nicklock.cpp +++ b/src/modules/m_nicklock.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_noctcp.cpp b/src/modules/m_noctcp.cpp index a3c82bd15..72fb4858c 100644 --- a/src/modules/m_noctcp.cpp +++ b/src/modules/m_noctcp.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_noinvite.cpp b/src/modules/m_noinvite.cpp index 868af242b..047af9047 100644 --- a/src/modules/m_noinvite.cpp +++ b/src/modules/m_noinvite.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_nokicks.cpp b/src/modules/m_nokicks.cpp index df2f98c84..cade4f340 100644 --- a/src/modules/m_nokicks.cpp +++ b/src/modules/m_nokicks.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_nonicks.cpp b/src/modules/m_nonicks.cpp index 3591b954d..1f44bfef6 100644 --- a/src/modules/m_nonicks.cpp +++ b/src/modules/m_nonicks.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_nonotice.cpp b/src/modules/m_nonotice.cpp index 85aa9b913..563b94b12 100644 --- a/src/modules/m_nonotice.cpp +++ b/src/modules/m_nonotice.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_operchans.cpp b/src/modules/m_operchans.cpp index 236c277f9..bd3d750bd 100644 --- a/src/modules/m_operchans.cpp +++ b/src/modules/m_operchans.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_operjoin.cpp b/src/modules/m_operjoin.cpp index 5a4eebccf..980fcc651 100644 --- a/src/modules/m_operjoin.cpp +++ b/src/modules/m_operjoin.cpp @@ -1,5 +1,7 @@ // operjoin module by typobox43 +using namespace std; + #include "users.h" #include "channels.h" #include "modules.h" diff --git a/src/modules/m_operlevels.cpp b/src/modules/m_operlevels.cpp index 271c3cb45..a112040f9 100644 --- a/src/modules/m_operlevels.cpp +++ b/src/modules/m_operlevels.cpp @@ -1,3 +1,5 @@ +using namespace std; + #include "users.h" #include "channels.h" #include "modules.h" diff --git a/src/modules/m_opermd5.cpp b/src/modules/m_opermd5.cpp index d7951d153..c2b923929 100644 --- a/src/modules/m_opermd5.cpp +++ b/src/modules/m_opermd5.cpp @@ -16,6 +16,8 @@ /* $ModDesc: Allows for MD5 encrypted oper passwords */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_opermotd.cpp b/src/modules/m_opermotd.cpp index d52bb0162..ffdb7da90 100644 --- a/src/modules/m_opermotd.cpp +++ b/src/modules/m_opermotd.cpp @@ -1,5 +1,7 @@ // opermotd module by typobox43 +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_override.cpp b/src/modules/m_override.cpp index 80066bb0f..459f99ca9 100644 --- a/src/modules/m_override.cpp +++ b/src/modules/m_override.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_park.cpp b/src/modules/m_park.cpp index 1cf69b46f..28733298f 100644 --- a/src/modules/m_park.cpp +++ b/src/modules/m_park.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <vector> diff --git a/src/modules/m_randquote.cpp b/src/modules/m_randquote.cpp index 5cd8a8572..67f4bcb95 100644 --- a/src/modules/m_randquote.cpp +++ b/src/modules/m_randquote.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <stdlib.h> #include <fstream> diff --git a/src/modules/m_redirect.cpp b/src/modules/m_redirect.cpp index f5df15945..2433896a8 100644 --- a/src/modules/m_redirect.cpp +++ b/src/modules/m_redirect.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_remove.cpp b/src/modules/m_remove.cpp index 0c9a29a1d..da4fc49d7 100644 --- a/src/modules/m_remove.cpp +++ b/src/modules/m_remove.cpp @@ -1,6 +1,8 @@ /* Support for a dancer-style /remove command, an alternative to /kick to try and avoid auto-rejoin-on-kick scripts */ /* Written by Om, 25-03-05 */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_restrictchans.cpp b/src/modules/m_restrictchans.cpp index a56df6177..d06223d4e 100644 --- a/src/modules/m_restrictchans.cpp +++ b/src/modules/m_restrictchans.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_restrictmsg.cpp b/src/modules/m_restrictmsg.cpp index 5d6453555..d73b4047d 100644 --- a/src/modules/m_restrictmsg.cpp +++ b/src/modules/m_restrictmsg.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <vector> diff --git a/src/modules/m_sajoin.cpp b/src/modules/m_sajoin.cpp index f1da3d1ed..038d511f6 100644 --- a/src/modules/m_sajoin.cpp +++ b/src/modules/m_sajoin.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_samode.cpp b/src/modules/m_samode.cpp index 9e96b9ed6..a20cb9ab9 100644 --- a/src/modules/m_samode.cpp +++ b/src/modules/m_samode.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + /* * SAMODE module for InspIRCd * Co authored by Brain and w00t diff --git a/src/modules/m_sanick.cpp b/src/modules/m_sanick.cpp index 6b874f272..4de8cf55d 100644 --- a/src/modules/m_sanick.cpp +++ b/src/modules/m_sanick.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_sapart.cpp b/src/modules/m_sapart.cpp index 1037ecc14..4c7927a64 100644 --- a/src/modules/m_sapart.cpp +++ b/src/modules/m_sapart.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_saquit.cpp b/src/modules/m_saquit.cpp index 525e5b716..40c81ccb0 100644 --- a/src/modules/m_saquit.cpp +++ b/src/modules/m_saquit.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + /* * SAQUIT module for InspIRCd * Author: w00t diff --git a/src/modules/m_services.cpp b/src/modules/m_services.cpp index 929c45f90..5b99ea76b 100644 --- a/src/modules/m_services.cpp +++ b/src/modules/m_services.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 0afffd6c1..c064bbe0b 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index 208635009..6b2778e79 100644 --- a/src/modules/m_setidle.cpp +++ b/src/modules/m_setidle.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_setname.cpp b/src/modules/m_setname.cpp index 8a481a3b4..2d59cb7b8 100644 --- a/src/modules/m_setname.cpp +++ b/src/modules/m_setname.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index 6d3220658..b7642a012 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -1,3 +1,5 @@ +using namespace std; + // showwhois module by typobox43 #include "users.h" diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 4f851f6a1..c423506a0 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include <vector> diff --git a/src/modules/m_stripcolor.cpp b/src/modules/m_stripcolor.cpp index 8d8b03cc0..ac9a64555 100644 --- a/src/modules/m_stripcolor.cpp +++ b/src/modules/m_stripcolor.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index f62858504..964420957 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include "users.h" #include "channels.h" diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index c0511838c..884a029b9 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -14,12 +14,9 @@ * --------------------------------------------------- */ -/* $ModDesc: Adds timed bans */ +using namespace std; -/* - * ToDo: - * Err... not a lot really. - */ +/* $ModDesc: Adds timed bans */ #include <stdio.h> #include <vector> diff --git a/src/modules/m_userip.cpp b/src/modules/m_userip.cpp index a077625c8..b2421ab43 100644 --- a/src/modules/m_userip.cpp +++ b/src/modules/m_userip.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <stdio.h> #include <string> #include "users.h" diff --git a/src/servers.cpp b/src/servers.cpp index e95d8e7c0..45ec5b00e 100644 --- a/src/servers.cpp +++ b/src/servers.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd_config.h" #include "servers.h" #include "inspircd.h" diff --git a/src/users.cpp b/src/users.cpp index 91542985a..48bb12430 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd_config.h" #include "channels.h" #include "users.h" diff --git a/src/wildcard.cpp b/src/wildcard.cpp index bf20ec782..46d90bd0e 100644 --- a/src/wildcard.cpp +++ b/src/wildcard.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include <string> #include "inspircd_config.h" #include "inspircd.h" diff --git a/src/xline.cpp b/src/xline.cpp index 7e96d0940..5b681444a 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -14,6 +14,8 @@ * --------------------------------------------------- */ +using namespace std; + #include "inspircd.h" #include "inspircd_io.h" #include "inspircd_util.h" @@ -47,8 +49,6 @@ #include "helperfuncs.h" #include "hashcomp.h" -using namespace std; - extern int MODCOUNT; extern std::vector<Module*, __single_client_alloc> modules; extern std::vector<ircd_module*, __single_client_alloc> factory; |