diff options
author | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-05-02 09:11:57 +0000 |
---|---|---|
committer | rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b <rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864> | 2004-05-02 09:11:57 +0000 |
commit | ee1ca39543172236e40ea98e88e9be6bd1fd0d24 (patch) | |
tree | 11845ea1fc005f0a7fe6ab84e929d3e14915b378 /modules.c | |
parent | f2ed3ecc8b66de929e0beeecfb2fc81f81201509 (diff) |
BUILD : 1.7.2 (78) BUGS : N/A NOTES : Added the ability to add module data to the NickCore and the NickAlias structs
git-svn-id: svn://svn.anope.org/anope/trunk@78 31f1291d-b8d6-0310-a050-a5561fc1590b
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@54 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'modules.c')
-rw-r--r-- | modules.c | 38 |
1 files changed, 37 insertions, 1 deletions
@@ -1941,23 +1941,59 @@ void moduleDelAllDataMod(Module * m) boolean freeme = false; int i; User *user; + NickAlias *na; + NickCore *nc; if (!mod_current_module_name) { mod_current_module_name = sstrdup(m->name); freeme = true; } for (i = 0; i < 1024; i++) { + /* Remove the users */ for (user = userlist[i]; user; user = user->next) { moduleDelAllData(user->moduleData); } + /* Remove the nick Cores */ + for (nc = nclists[i]; nc; nc = nc->next) { + moduleDelAllData(nc->moduleData); + } + /* Remove the nick Aliases */ + for (na = nalists[i]; na; na = na->next) { + moduleDelAllData(na->moduleData); + } } - if (freeme) { free(mod_current_module_name); mod_current_module_name = NULL; } } +/** + * Remove any data fro many 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; + 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); + } + } +} + /* EOF */ |