From a08e07b05d737a20f404841ac925fa0ff75eca54 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 7 Nov 2012 12:25:02 +0000 Subject: - conf.c: cleanup detach_conf() git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1645 82007160-df01-0410-b94d-b575c5fd34c7 --- src/conf.c | 45 ++++++++++++++++++--------------------------- 1 file changed, 18 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/conf.c b/src/conf.c index cafa9e0..6a7806a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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); } } -- cgit