X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fhelperfuncs.cpp;h=02a23c0acf73ad33137d80a35db158ce54b7afdb;hb=c4458ecc70025aeac7ca87115ed0a698e7bbcdad;hp=19ae22dc24825ce5ccb995c366c583b76cf5091e;hpb=4f5ef4c1ae94f66b89e04e5b4f246103abed8332;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 19ae22dc2..02a23c0ac 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -51,7 +51,7 @@ extern InspIRCd* ServerInstance; extern time_t TIME; extern char lowermap[255]; extern userrec* fd_ref_table[MAX_DESCRIPTORS]; -static int already_sent[MAX_DESCRIPTORS]; +static unsigned long already_sent[MAX_DESCRIPTORS] = {0}; extern std::vector all_opers; extern user_hash clientlist; extern chan_hash chanlist; @@ -64,7 +64,7 @@ static char TIMESTR[26]; static time_t LAST = 0; /* XXX: Used for speeding up WriteCommon operations */ -int uniq_id = 0; +unsigned long uniq_id = 0; /** log() * Write a line of text `text' to the logfile (and stdout, if in nofork) if the level `level' @@ -709,14 +709,8 @@ void WriteCommon(userrec *u, char* text, ...) vsnprintf(textbuffer, MAXBUF, text, argsPtr); va_end(argsPtr); - // XXX: Save on memset calls by only requiring memset every 4 billion or so - // messages. This clever trick thought of during discussion with nazzy and w00t. + // XXX: Save on memset calls by using an ID. This clever trick thought of during discussion with nazzy and w00t. uniq_id++; - if (!uniq_id) - { - memset(&already_sent,0,MAX_DESCRIPTORS); - uniq_id++; - } for (std::vector::const_iterator v = u->chans.begin(); v != u->chans.end(); v++) { @@ -764,11 +758,6 @@ void WriteCommon_NoFormat(userrec *u, const char* text) // XXX: See comment in WriteCommon uniq_id++; - if (!uniq_id) - { - memset(&already_sent,0,MAX_DESCRIPTORS); - uniq_id++; - } for (std::vector::const_iterator v = u->chans.begin(); v != u->chans.end(); v++) { @@ -869,11 +858,6 @@ void WriteCommonExcept(userrec *u, char* text, ...) } uniq_id++; - if (!uniq_id) - { - memset(&already_sent,0,MAX_DESCRIPTORS); - uniq_id++; - } for (std::vector::const_iterator v = u->chans.begin(); v != u->chans.end(); v++) { @@ -917,11 +901,6 @@ void WriteCommonExcept_NoFormat(userrec *u, const char* text) } uniq_id++; - if (!uniq_id) - { - memset(&already_sent,0,MAX_DESCRIPTORS); - uniq_id++; - } for (std::vector::const_iterator v = u->chans.begin(); v != u->chans.end(); v++) {