X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/blobdiff_plain/b90b52aed59ca92b957c0c27b16f223f11671ec3..78546f2b0f59b5c8fede1ce5535972716eb17041:/patricianick/patricianick.c diff --git a/patricianick/patricianick.c b/patricianick/patricianick.c index 52916422..44de41dc 100644 --- a/patricianick/patricianick.c +++ b/patricianick/patricianick.c @@ -7,13 +7,13 @@ #include "../core/nsmalloc.h" #include "../control/control.h" #include "../core/schedule.h" +#include "../lib/version.h" #include #include -#define ALLOCUNIT 100 +MODULE_VERSION("") -patricianick_t *freepatricianicks; int pnode_ext; int pnick_ext; @@ -65,19 +65,10 @@ void _fini() { } patricianick_t *getpatricianick() { - int i; - patricianick_t *pnp; - - if (freepatricianicks==NULL) { - freepatricianicks=(patricianick_t *)nsmalloc(POOL_PATRICIANICK, ALLOCUNIT*sizeof(patricianick_t)); - for(i=0;iidenthash[0]; + if (!pnp) + return NULL; memset(pnp, 0, sizeof(patricianick_t)); return pnp; @@ -86,6 +77,8 @@ patricianick_t *getpatricianick() { void addnicktonode(patricia_node_t *node, nick *np) { unsigned long hash; + patricia_ref_prefix(node->prefix); + if (!(node->exts[pnode_ext])) { node->exts[pnode_ext] = getpatricianick(); } @@ -125,8 +118,7 @@ void deletenickfromnode(patricia_node_t *node, nick *np) { } void freepatricianick(patricianick_t *pnp) { - pnp->identhash[0]=(nick *)freepatricianicks; - freepatricianicks=pnp; + nsfree(POOL_PATRICIANICK, pnp); } void pn_hook_newuser(int hook, void *arg) {