diff options
-rw-r--r-- | Changes | 1 | ||||
-rwxr-xr-x | Config | 3 | ||||
-rw-r--r-- | include/extern.h | 2 | ||||
-rw-r--r-- | include/modules.h | 12 | ||||
-rw-r--r-- | include/services.h | 26 | ||||
-rw-r--r-- | include/version.sh | 21 | ||||
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/chanserv.c | 8 | ||||
-rw-r--r-- | src/main.c | 9 | ||||
-rw-r--r-- | src/memoserv.c | 7 | ||||
-rw-r--r-- | src/modules.c | 329 | ||||
-rw-r--r-- | src/mysql.c | 8 | ||||
-rw-r--r-- | src/nickserv.c | 14 | ||||
-rw-r--r-- | src/operserv.c | 2 | ||||
-rw-r--r-- | src/users.c | 2 | ||||
-rw-r--r-- | version.log | 6 |
16 files changed, 218 insertions, 234 deletions
@@ -3,6 +3,7 @@ Anope Version S V N Provided by Anope Dev. <dev@anope.org> - 2004 08/24 A New -l option for am script to list possible selectors. [ #00] 09/08 A Removed rand() and ported bsd's arc4random() to fit our needs. [ #00] +09/19 F Rewrote the internals of moduleData to save lots of memory. [ #00] 09/17 F Fixed MySQL error, whereby checks are only done if mysql is on. [ #00] 09/14 F Fixed /os MODE by joining nested ifs into one. [ #00] 09/14 F Protection unsetting now does -a instead of +a. [ #00] @@ -378,5 +378,8 @@ if [ "$UMASK" != "" ] ; then WITH_PERM=" --with-permissions=$UMASK" fi + +echo "./configure $WITH_BIN $WITH_DATA $WITH_ENC $WITH_IRCD $WITH_RUN $WITH_PERM" + ./configure $WITH_BIN $WITH_DATA $WITH_ENC $WITH_IRCD $WITH_RUN $WITH_PERM diff --git a/include/extern.h b/include/extern.h index 68d94efe6..0261abfdf 100644 --- a/include/extern.h +++ b/include/extern.h @@ -653,7 +653,7 @@ E u_int32_t getrandom32(void); /**** modules.c ****/ E void moduleCallBackRun(void); -E void moduleCleanStruct(ModuleData * moduleData[]); +E void moduleCleanStruct(ModuleData **moduleData); /**** news.c ****/ diff --git a/include/modules.h b/include/modules.h index d240ab79b..500d5e025 100644 --- a/include/modules.h +++ b/include/modules.h @@ -220,12 +220,14 @@ int moduleAddCallback(char *name,time_t when,int (*func)(int argc, char *argv[]) void moduleDelCallback(char *name); void moduleCallBackRun(void); -char *moduleGetData(ModuleData *md[], char *key); /* Get the value for this key from this struct */ -int moduleAddData(ModuleData *md[], char *key, char *value); /* Set the value for this key for this struct */ -void moduleDelData(ModuleData *md[], char *key); /* Delete this key/value pair */ -void moduleDelAllData(ModuleData *md[]); /* Delete all key/value pairs for this module for this struct */ -void moduleCleanStruct(ModuleData * moduleData[]); /* Clean a moduleData hash */ +char *moduleGetData(ModuleData **md, char *key); /* Get the value for this key from this struct */ +int moduleAddData(ModuleData **md, char *key, char *value); /* Set the value for this key for this struct */ +void moduleDelData(ModuleData **md, char *key); /* Delete this key/value pair */ +void moduleDelAllData(ModuleData **md); /* Delete all key/value pairs for this module for this struct */ +void moduleCleanStruct(ModuleData **moduleData); /* Clean a moduleData hash */ void moduleDelAllDataMod(Module *m); /* remove all module data from all structs for this module */ +int moduleDataDebug(ModuleData **md); /* Allow for debug output of a moduleData struct */ +boolean moduleMinVersion(int major,int minor,int patch,int build); /* Checks if the current version of anope is before or after a given verison */ /*************************************************************************/ diff --git a/include/services.h b/include/services.h index c63fd8d81..726bc2a7c 100644 --- a/include/services.h +++ b/include/services.h @@ -129,7 +129,6 @@ typedef struct server_ Server; typedef struct user_ User; typedef struct channel_ Channel; typedef struct ModuleData_ ModuleData; /* ModuleData struct */ -typedef struct ModuleDataItem_ ModuleDataItem; /* A Module Data Item struct */ typedef struct memo_ Memo; typedef struct nickrequest_ NickRequest; typedef struct nickalias_ NickAlias; @@ -301,19 +300,14 @@ struct ircdcapab_ { * ModuleData strucs used to allow modules to add / delete module Data from existing structs */ -struct ModuleDataItem_ { - char *key; /* The key */ - char *value; /* The Value */ - ModuleDataItem *next; /* The next ModuleDataItem in this list */ -}; - -struct ModuleData_ { +struct ModuleData_ { char *moduleName; /* Which module we belong to */ - ModuleDataItem *di; /* The first Item they own */ + char *key; /* The key */ + char *value; /* The Value */ ModuleData *next; /* The next ModuleData record */ }; - -/*************************************************************************/ + + /*************************************************************************/ /* Memo info structures. Since both nicknames and channels can have memos, * we encapsulate memo data in a MemoList to make it easier to handle. */ @@ -324,7 +318,7 @@ struct memo_ { time_t time; /* When it was sent */ char sender[NICKMAX]; char *text; - ModuleData *moduleData[1024]; /* Module saved data attached to the Memo */ + ModuleData *moduleData; /* Module saved data attached to the Memo */ }; typedef struct { @@ -358,7 +352,7 @@ struct nickalias_ { int16 status; /* See NS_* below */ NickCore *nc; /* I'm an alias of this */ /* Not saved */ - ModuleData *moduleData[1024]; /* Module saved data attached to the nick alias */ + ModuleData *moduleData; /* Module saved data attached to the nick alias */ User *u; /* Current online user that has me */ }; @@ -380,7 +374,7 @@ struct nickcore_ { uint16 channelmax; /* Maximum number of channels allowed */ /* Unsaved data */ - ModuleData *moduleData[1024]; /* Module saved data attached to the NickCore */ + ModuleData *moduleData; /* Module saved data attached to the NickCore */ time_t lastmail; /* Last time this nick record got a mail */ SList aliases; /* List of aliases */ }; @@ -514,7 +508,7 @@ struct chaninfo_ { struct channel_ *c; /* Pointer to channel record (if * * channel is currently in use) */ - ModuleData *moduleData[1024]; /* Module saved data attached to the ChannelInfo */ + ModuleData *moduleData; /* Module saved data attached to the ChannelInfo */ /* For BotServ */ @@ -695,7 +689,7 @@ struct user_ { NickAlias *na; - ModuleData *moduleData[1024]; /* defined for it, it should allow the module Add/Get */ + ModuleData *moduleData; /* defined for it, it should allow the module Add/Get */ int isSuperAdmin; /* is SuperAdmin on or off? */ diff --git a/include/version.sh b/include/version.sh index 2ff3bb5a3..4070a52a1 100644 --- a/include/version.sh +++ b/include/version.sh @@ -38,17 +38,17 @@ cat >version.h <<EOF * */ -#define VERSION_MAJOR "$VERSION_MAJOR" -#define VERSION_MINOR "$VERSION_MINOR" -#define VERSION_PATCH "$VERSION_PATCH" -#define VERSION_EXTRA "$VERSION_EXTRA" -#define VERSION_BUILD "$VERSION_BUILD" + #ifndef VERSION_H + #define VERSION_H + +#define VERSION_MAJOR $VERSION_MAJOR +#define VERSION_MINOR $VERSION_MINOR +#define VERSION_PATCH $VERSION_PATCH +#define VERSION_EXTRA $VERSION_EXTRA +#define VERSION_BUILD $VERSION_BUILD #define BUILD "$BUILD" - -const char version_number[] = "$VERSION"; -const char version_build[] = - "build #" BUILD ", compiled " __DATE__ " " __TIME__; +#define VERSION_STRING "$VERSION" #ifdef DEBUG_COMMANDS # define VER_DEBUG "D" @@ -106,8 +106,7 @@ const char version_build[] = # define VER_MODULE #endif -/* the space is needed cause if you build with nothing it will complain */ -const char version_flags[] = " " VER_DEBUG VER_ENCRYPTION VER_THREAD VER_OS VER_GHBNR VER_MYSQL VER_MODULE; +#endif EOF diff --git a/src/Makefile b/src/Makefile index 3465c8e47..7db726aa3 100644 --- a/src/Makefile +++ b/src/Makefile @@ -20,7 +20,7 @@ INCLUDES = ../include/commands.h ../include/defs.h ../include/language.h \ ../include/pseudo.h ../include/sysconf.h ../include/config.h \ ../include/encrypt.h ../include/messages.h ../include/services.h \ ../include/timeout.h ../include/datafiles.h ../include/extern.h \ - ../include/modules.h ../include/slist.h ../include/version.h \ + ../include/modules.h ../include/slist.h \ ../include/dreamforge.h ../include/bahamut.h ../include/ultimate2.h \ ../include/ultimate3.h ../include/hybrid.h ../include/ptlink.h ../include/unreal31.h \ ../include/viagra.h ../include/rageircd.h ../include/unreal32.h diff --git a/src/chanserv.c b/src/chanserv.c index 4a1ad524b..e210ac5ac 100644 --- a/src/chanserv.c +++ b/src/chanserv.c @@ -912,9 +912,7 @@ void load_cs_dbase(void) memos->time = tmp32; SAFE(read_buffer(memos->sender, f)); SAFE(read_string(&memos->text, f)); - for (m = 0; m < MAX_CMD_HASH; m++) { - memos->moduleData[m] = NULL; - } + memos->moduleData = NULL; } } @@ -2097,7 +2095,7 @@ int delchan(ChannelInfo * ci) for (i = 0; i < ci->memos.memocount; i++) { if (ci->memos.memos[i].text) free(ci->memos.memos[i].text); - moduleCleanStruct(ci->memos.memos[i].moduleData); + moduleCleanStruct(&ci->memos.memos[i].moduleData); } free(ci->memos.memos); } @@ -2110,7 +2108,7 @@ int delchan(ChannelInfo * ci) if (ci->badwords) free(ci->badwords); - moduleCleanStruct(ci->moduleData); + moduleCleanStruct(&ci->moduleData); free(ci); if (nc) diff --git a/src/main.c b/src/main.c index bc7bb6672..15660e2fc 100644 --- a/src/main.c +++ b/src/main.c @@ -75,6 +75,15 @@ time_t start_time; /* Parameters and environment */ char **my_av, **my_envp; +/* Moved here from version.h */ +const char version_number[] = VERSION_STRING; +const char version_build[] = + "build #" BUILD ", compiled " __DATE__ " " __TIME__; +/* the space is needed cause if you build with nothing it will complain */ +const char version_flags[] = + " " VER_DEBUG VER_ENCRYPTION VER_THREAD VER_OS VER_GHBNR VER_MYSQL + VER_MODULE; + /******** Local variables! ********/ /* Set to 1 if we are waiting for input */ diff --git a/src/memoserv.c b/src/memoserv.c index e182f0535..716f1a1bc 100644 --- a/src/memoserv.c +++ b/src/memoserv.c @@ -192,7 +192,7 @@ static int delmemo(MemoInfo * mi, int num) break; } if (i < mi->memocount) { - moduleCleanStruct(mi->memos[i].moduleData); + moduleCleanStruct(&mi->memos[i].moduleData); free(mi->memos[i].text); /* Deallocate memo text memory */ mi->memocount--; /* One less memo now */ if (i < mi->memocount) /* Move remaining memos down a slot */ @@ -315,8 +315,7 @@ void memo_send(User * u, char *name, char *text, int z) mi->memos = srealloc(mi->memos, sizeof(Memo) * mi->memocount); m = &mi->memos[mi->memocount - 1]; strscpy(m->sender, source, NICKMAX); - for (j = 0; j < MAX_CMD_HASH; j++) - m->moduleData[j] = NULL; + m->moduleData = NULL; if (mi->memocount > 1) { m->number = m[-1].number + 1; if (m->number < 1) { @@ -786,7 +785,7 @@ static int do_del(User * u) /* Delete all memos. */ for (i = 0; i < mi->memocount; i++) { free(mi->memos[i].text); - moduleCleanStruct(mi->memos[i].moduleData); + moduleCleanStruct(&mi->memos[i].moduleData); } free(mi->memos); mi->memos = NULL; diff --git a/src/modules.c b/src/modules.c index 7ddf164b6..eca88077f 100644 --- a/src/modules.c +++ b/src/modules.c @@ -14,6 +14,7 @@ */ #include "modules.h" #include "language.h" +#include "version.h" #ifdef USE_MODULES #include <dlfcn.h> @@ -1749,6 +1750,24 @@ void moduleDisplayHelp(int service, User * u) } /** + * Output module data information into the log file. + * This is a vwey "debug only" function to dump the whole contents + * of a moduleData struct into the log files. + * @param md The module data for the struct to be used + * @return 0 is always returned; + **/ +int moduleDataDebug(ModuleData **md) { + ModuleData *current = NULL; + alog("Dumping module data...."); + for (current = *md; current; current = current->next) { + alog("Module: [%s]",current->moduleName); + alog(" Key [%s]\tValue [%s]",current->key, current->value); + } + alog("End of module data dump"); + return 0; +} + +/** * Add module data to a struct. * This allows module coders to add data to an existing struct * @param md The module data for the struct to be used @@ -1756,72 +1775,40 @@ void moduleDisplayHelp(int service, User * u) * @param value The value for the key/value pair, this is what will be stored for you * @return MOD_ERR_OK will be returned on success **/ -int moduleAddData(ModuleData * md[], char *key, char *value) +int moduleAddData(ModuleData **md, char *key, char *value) { - char *mod_name = sstrdup(mod_current_module_name); - - int index = 0; - ModuleData *current = NULL; - ModuleData *newHash = NULL; - ModuleData *lastHash = NULL; - ModuleDataItem *item = NULL; - ModuleDataItem *itemCurrent = NULL; - ModuleDataItem *lastItem = NULL; - index = CMD_HASH(mod_name); - - if (!key || !value) { - alog("A module tried to use ModuleAddData() with one ore more NULL arguments... returning"); - return MOD_ERR_PARAMS; - } - - for (current = md[index]; current; current = current->next) { - if (stricmp(current->moduleName, mod_name) == 0) - lastHash = current; - } - - if (!lastHash) { - newHash = malloc(sizeof(ModuleData)); - if (!newHash) { - return MOD_ERR_MEMORY; - } - newHash->next = NULL; - newHash->di = NULL; - newHash->moduleName = strdup(mod_name); - md[index] = newHash; - lastHash = newHash; - } - - /** - * Ok, at this point lastHash will always be a valid ModuleData struct, and will always be "our" module Data Struct - **/ - for (itemCurrent = lastHash->di; itemCurrent; - itemCurrent = itemCurrent->next) { - if (stricmp(itemCurrent->key, key) == 0) { - item = itemCurrent; - } - lastItem = itemCurrent; - } - if (!item) { - item = malloc(sizeof(ModuleDataItem)); - if (!item) { - return MOD_ERR_MEMORY; - } - item->next = NULL; - item->key = strdup(key); - item->value = strdup(value); - if (lastItem) - lastItem->next = item; - else - lastHash->di = item; - } else { - free(item->key); - free(item->value); - item->key = strdup(key); - item->value = strdup(value); - } - free(mod_name); - return MOD_ERR_OK; - + char *mod_name = sstrdup(mod_current_module_name); + ModuleData *newData=NULL; + ModuleData *tmp = *md; + + if ( !key || !value ) { + alog("A module tried to use ModuleAddData() with one ore more NULL arguments... returning"); + return MOD_ERR_PARAMS; + } + + moduleDelData(md,key); /* Remove any existing module data for this module with the same key */ + + newData = malloc(sizeof(ModuleData)); + if(!newData) { + return MOD_ERR_MEMORY; + } + + newData->moduleName = sstrdup(mod_name); + newData->key = sstrdup(key); + newData->value = sstrdup(value); + if(tmp) { + newData->next = tmp->next; + } else { + newData->next = NULL; + } + *md = newData; + + free(mod_name); + + if(debug) { + moduleDataDebug(md); + } + return MOD_ERR_OK; } /** @@ -1831,33 +1818,17 @@ int moduleAddData(ModuleData * md[], char *key, char *value) * @param key The key to find the data for * @return the value paired to the given key will be returned, or NULL **/ -char *moduleGetData(ModuleData * md[], char *key) +char *moduleGetData(ModuleData **md, char *key) { char *mod_name = sstrdup(mod_current_module_name); - int index = 0; - char *ret = NULL; - ModuleData *current = NULL; - ModuleData *lastHash = NULL; - ModuleDataItem *itemCurrent = NULL; - index = CMD_HASH(mod_name); - if (!md) { - return NULL; - } - for (current = md[index]; current; current = current->next) { - if (stricmp(current->moduleName, mod_name) == 0) - lastHash = current; - } - - if (lastHash) { - for (itemCurrent = lastHash->di; itemCurrent; - itemCurrent = itemCurrent->next) { - if (strcmp(itemCurrent->key, key) == 0) { - ret = strdup(itemCurrent->value); - } - } + ModuleData *current = *md; + while(current) { + if((stricmp(current->moduleName,mod_name)==0) && (stricmp(current->key,key)==0)) { + return sstrdup(current->value); + } } free(mod_name); - return ret; + return NULL; } /** @@ -1866,39 +1837,31 @@ char *moduleGetData(ModuleData * md[], char *key) * @param md The module data for the struct to be used * @param key The key to delete the key/value pair for **/ -void moduleDelData(ModuleData * md[], char *key) +void moduleDelData(ModuleData **md, char *key) { char *mod_name = sstrdup(mod_current_module_name); - int index = 0; - ModuleData *current = NULL; - ModuleData *lastHash = NULL; - - ModuleDataItem *itemCurrent = NULL; - ModuleDataItem *prev = NULL; - ModuleDataItem *next = NULL; - index = CMD_HASH(mod_name); - - for (current = md[index]; current; current = current->next) { - if (stricmp(current->moduleName, mod_name) == 0) - lastHash = current; - } - if (lastHash) { - for (itemCurrent = lastHash->di; itemCurrent; itemCurrent = next) { - next = itemCurrent->next; - if (strcmp(key, itemCurrent->key) == 0) { - free(itemCurrent->key); - free(itemCurrent->value); - itemCurrent->next = NULL; - free(itemCurrent); - if (prev) { - prev->next = next; - } else { - lastHash->di = next; - } - } else { - prev = itemCurrent; - } - } + ModuleData *current = *md; + ModuleData *prev = NULL; + ModuleData *next = NULL; + + if(key) { + while(current) { + next = current->next; + if((stricmp(current->moduleName,mod_name)==0) && (stricmp(current->key,key)==0)) { + if(prev) { + prev->next = current->next; + } else { + *md = current->next; + } + free(current->moduleName); + free(current->key); + free(current->value); + current->next = NULL; + free(current); + } + prev = current;; + current = next; + } } free(mod_name); } @@ -1909,35 +1872,29 @@ void moduleDelData(ModuleData * md[], char *key) * do just about anything and everything, its safe to use from inside the module. * @param md The module data for the struct to be used **/ -void moduleDelAllData(ModuleData * md[]) +void moduleDelAllData(ModuleData **md) { char *mod_name = sstrdup(mod_current_module_name); - int index = 0; - ModuleData *current = NULL; - ModuleData *lastHash = NULL; - - ModuleDataItem *itemCurrent = NULL; - ModuleDataItem *prev = NULL; - ModuleDataItem *next = NULL; - index = CMD_HASH(mod_name); - - for (current = md[index]; current; current = current->next) { - if (stricmp(current->moduleName, mod_name) == 0) - lastHash = current; - } - if (lastHash) { - for (itemCurrent = lastHash->di; itemCurrent; itemCurrent = next) { - next = itemCurrent->next; - free(itemCurrent->key); - free(itemCurrent->value); - itemCurrent->next = NULL; - free(itemCurrent); - if (prev) { - prev->next = next; - } else { - lastHash->di = next; - } - } + ModuleData *current = *md; + ModuleData *prev = NULL; + ModuleData *next = NULL; + + while(current) { + next = current->next; + if((stricmp(current->moduleName,mod_name)==0)) { + if(prev) { + prev->next = current->next; + } else { + *md = current->next; + } + free(current->moduleName); + free(current->key); + free(current->value); + current->next = NULL; + free(current); + } + prev = current;; + current = next; } free(mod_name); } @@ -1946,7 +1903,7 @@ void moduleDelAllData(ModuleData * md[]) * This will delete all module data used in any struct by module m. * @param m The module to clear all data for **/ -void moduleDelAllDataMod(Module * m) +void moduleDelAllDataMod(Module *m) { boolean freeme = false; int i, j; @@ -1963,29 +1920,29 @@ void moduleDelAllDataMod(Module * m) for (i = 0; i < 1024; i++) { /* Remove the users */ for (user = userlist[i]; user; user = user->next) { - moduleDelAllData(user->moduleData); + moduleDelAllData(&user->moduleData); } /* Remove the nick Cores */ for (nc = nclists[i]; nc; nc = nc->next) { - moduleDelAllData(nc->moduleData); + moduleDelAllData(&nc->moduleData); /* Remove any memo data for this nick core */ for (j = 0; j < nc->memos.memocount; j++) { - moduleCleanStruct(nc->memos.memos[j].moduleData); + moduleCleanStruct(&nc->memos.memos[j].moduleData); } } /* Remove the nick Aliases */ for (na = nalists[i]; na; na = na->next) { - moduleDelAllData(na->moduleData); + moduleDelAllData(&na->moduleData); } } for (i = 0; i < 256; i++) { /* Remove any chan info data */ for (ci = chanlists[i]; ci; ci = ci->next) { - moduleDelAllData(ci->moduleData); + moduleDelAllData(&ci->moduleData); /* Remove any memo data for this nick core */ for (j = 0; j < ci->memos.memocount; j++) { - moduleCleanStruct(ci->memos.memos[j].moduleData); + moduleCleanStruct(&ci->memos.memos[j].moduleData); } } } @@ -1997,30 +1954,56 @@ void moduleDelAllDataMod(Module * m) } /** - * Remove any data fro many module used in the given struct. + * Remove any data from any module used in the given struct. * Useful for cleaning up when a User leave's the net, a NickCore is deleted, etc... * @param moduleData the moduleData struct to "clean" **/ -void moduleCleanStruct(ModuleData * moduleData[]) -{ - ModuleData *md = NULL, *nextMd = NULL; - ModuleDataItem *item = NULL, *nextItem = NULL; - int i; +void moduleCleanStruct(ModuleData **moduleData) { + ModuleData *current = *moduleData;; + ModuleData *next = NULL; + + while(current) { + next = current->next; + free(current->moduleName); + free(current->key); + free(current->value); + current->next = NULL; + free(current); + current = next; + } + *moduleData = NULL; +} - for (i = 0; i < 1024; i++) { - for (md = moduleData[i]; md; md = nextMd) { - nextMd = md->next; - for (item = md->di; item; item = nextItem) { - nextItem = item->next; - free(item->key); - free(item->value); - item->next = NULL; - free(item); - } - free(md->moduleName); - free(md); - } - } +/** + * Check the current version of anope against a given version number + * Specifiying -1 for minor,patch or build + * @param major The major version of anope, the first part of the verison number + * @param minor The minor version of anope, the second part of the version number + * @param patch The patch version of anope, the third part of the version number + * @param build The build revision of anope from SVN + * @return True if the version newer than the version specified. + **/ +boolean moduleMinVersion(int major,int minor,int patch,int build) { + boolean ret=false; + if(VERSION_MAJOR>major) { // Def. new + ret = true; + } else if(VERSION_MAJOR == major) { // Might be newer + if(minor == -1) { return true; } // They dont care about minor + if(VERSION_MINOR > minor) { // Def. newer + ret = true; + } else if(VERSION_MINOR == minor) { // Might be newer + if(patch == -1) { return true; } // They dont care about patch + if(VERSION_PATCH > patch) { + ret = true; + } else if(VERSION_PATCH == patch) { + if(build == -1) { return true; } // They dont care about build + if(VERSION_BUILD >= build) { + ret = true; + } + } + } + } + return ret; } /* EOF */ diff --git a/src/mysql.c b/src/mysql.c index 896eb9216..d0771faa0 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -1331,9 +1331,7 @@ void db_mysql_load_cs_dbase(void) memos->time = atoi(row[2]); snprintf(memos->sender, NICKMAX, "%s", row[3]); memos->text = sstrdup(row[4]); - for (m = 0; m < MAX_CMD_HASH; m++) { - memos->moduleData[m] = NULL; - } + memos->moduleData = NULL; memos++; } } @@ -1545,9 +1543,7 @@ void db_mysql_load_ns_dbase(void) memos->time = atoi(row[2]); snprintf(memos->sender, NICKMAX, "%s", row[3]); memos->text = sstrdup(row[4]); - for (m = 0; m < MAX_CMD_HASH; m++) { - memos->moduleData[m] = NULL; - } + memos->moduleData = NULL; memos++; } mysql_free_result(res); diff --git a/src/nickserv.c b/src/nickserv.c index a654cf65a..1ca4a90e7 100644 --- a/src/nickserv.c +++ b/src/nickserv.c @@ -558,9 +558,7 @@ void load_old_ns_dbase(void) memos->time = tmp32; SAFE(read_buffer(memos->sender, f)); SAFE(read_string(&memos->text, f)); - for (m = 0; m < MAX_CMD_HASH; m++) { - memos->moduleData[m] = NULL; - } + memos->moduleData = NULL; } } @@ -757,9 +755,7 @@ void load_ns_dbase(void) memos->time = tmp32; SAFE(read_buffer(memos->sender, f)); SAFE(read_string(&memos->text, f)); - for (m = 0; m < MAX_CMD_HASH; m++) { - memos->moduleData[m] = NULL; - } + memos->moduleData = NULL; } } @@ -1562,13 +1558,13 @@ static int delcore(NickCore * nc) if (nc->memos.memos) { for (i = 0; i < nc->memos.memocount; i++) { if (nc->memos.memos[i].text) - moduleCleanStruct(nc->memos.memos[i].moduleData); + moduleCleanStruct(&nc->memos.memos[i].moduleData); free(nc->memos.memos[i].text); } free(nc->memos.memos); } - moduleCleanStruct(nc->moduleData); + moduleCleanStruct(&nc->moduleData); free(nc); @@ -1666,7 +1662,7 @@ int delnick(NickAlias * na) if (na->last_quit) free(na->last_quit); - moduleCleanStruct(na->moduleData); + moduleCleanStruct(&na->moduleData); free(na); diff --git a/src/operserv.c b/src/operserv.c index 2d643aa01..92130c790 100644 --- a/src/operserv.c +++ b/src/operserv.c @@ -3096,7 +3096,7 @@ static int do_sqline(User * u) if (mask && (reason = strtok(NULL, ""))) { /* We first do some sanity check on the proposed mask. */ - if (strspn(mask, "*?") == strlen(mask)) { + if (strspn(mask, "*") == strlen(mask)) { notice_lang(s_OperServ, u, USERHOST_MASK_TOO_WIDE, mask); return MOD_CONT; } diff --git a/src/users.c b/src/users.c index 723cf65da..a3b4fa8fe 100644 --- a/src/users.c +++ b/src/users.c @@ -242,7 +242,7 @@ void delete_user(User * user) if (user->nickTrack) free(user->nickTrack); - moduleCleanStruct(user->moduleData); + moduleCleanStruct(&user->moduleData); if (debug >= 2) alog("debug: delete_user(): delete from list"); diff --git a/version.log b/version.log index 13354f10f..517fffe00 100644 --- a/version.log +++ b/version.log @@ -8,10 +8,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="5" -VERSION_BUILD="350" +VERSION_BUILD="351" # $Log$ # +# BUILD : 1.7.5 (351) +# BUGS : N/A +# NOTES : Rewrote the internals of moduleData, this will save _lots_ of memory especially on larger networks. The downside is modules using it need to make a tiny, tiny change... :/ +# # BUILD : 1.7.5 (350) # BUGS : # NOTES : Changed mysql init checks so they are only done if mysql is |