diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-07 12:25:02 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2012-11-07 12:25:02 +0000 |
commit | a08e07b05d737a20f404841ac925fa0ff75eca54 (patch) | |
tree | 257945080f78529c078cb9df57e6ed0fd1be9fb0 | |
parent | fe272d05ac511dce6b31d7d8e3ec5d753c7ec416 (diff) |
- conf.c: cleanup detach_conf()
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1645 82007160-df01-0410-b94d-b575c5fd34c7
-rw-r--r-- | src/conf.c | 45 |
1 files changed, 18 insertions, 27 deletions
@@ -888,41 +888,32 @@ void detach_conf(struct Client *client_p, enum maskitem_type type) { dlink_node *ptr = NULL, *next_ptr = NULL; - struct MaskItem *conf = NULL; DLINK_FOREACH_SAFE(ptr, next_ptr, client_p->localClient->confs.head) { - conf = ptr->data; + struct MaskItem *conf = ptr->data; - if (conf->type & type) - { - dlinkDelete(ptr, &client_p->localClient->confs); - free_dlink_node(ptr); + assert(conf->type & (CONF_CLIENT | CONF_OPER | CONF_SERVER)); + assert(conf->ref_count > 0); + assert(conf->class->ref_count > 0); - switch (conf->type) - { - case CONF_CLIENT: - case CONF_OPER: - case CONF_SERVER: - assert(conf->ref_count > 0); - assert(conf->class->ref_count > 0); - - if (conf->type == CONF_CLIENT) - remove_from_cidr_check(&client_p->localClient->ip, conf->class); - if (--conf->class->ref_count == 0 && conf->class->active == 0) - { - class_free(conf->class); - conf->class = NULL; - } + if (!(conf->type & type)) + continue; - if (--conf->ref_count == 0 && conf->active == 0) - conf_free(conf); + dlinkDelete(ptr, &client_p->localClient->confs); + free_dlink_node(ptr); - break; - default: - break; - } + if (conf->type == CONF_CLIENT) + remove_from_cidr_check(&client_p->localClient->ip, conf->class); + + if (--conf->class->ref_count == 0 && conf->class->active == 0) + { + class_free(conf->class); + conf->class = NULL; } + + if (--conf->ref_count == 0 && conf->active == 0) + conf_free(conf); } } |