summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-07 12:25:02 +0000
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>2012-11-07 12:25:02 +0000
commita08e07b05d737a20f404841ac925fa0ff75eca54 (patch)
tree257945080f78529c078cb9df57e6ed0fd1be9fb0 /src
parentfe272d05ac511dce6b31d7d8e3ec5d753c7ec416 (diff)
- conf.c: cleanup detach_conf()
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1645 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'src')
-rw-r--r--src/conf.c45
1 files changed, 18 insertions, 27 deletions
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);
}
}