From ebb5967a19ee6abdd70a965ff8ca127df47f136f Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 13 Nov 2012 20:28:53 +0000 Subject: - changed match() polarity. match() now returns 0 on match and 1 on non-match This cleans up several places where function pointers of different matching functions like irccmp/strcmp/match are passed to other functions. - added improved collapse() to match.c git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/trunk@1652 82007160-df01-0410-b94d-b575c5fd34c7 --- src/conf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/conf.c') diff --git a/src/conf.c b/src/conf.c index 7d04bd0..765c47a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -969,7 +969,7 @@ attach_connect_block(struct Client *client_p, const char *name, { conf = ptr->data; - if (match(conf->name, name) == 0 || match(conf->host, host) == 0) + if (match(conf->name, name) || match(conf->host, host)) continue; attach_conf(client_p, conf); @@ -1001,7 +1001,7 @@ find_conf_name(dlink_list *list, const char *name, enum maskitem_type type) if (conf->type == type) { if (conf->name && (irccmp(conf->name, name) == 0 || - match(conf->name, name))) + !match(conf->name, name))) return conf; } } @@ -1113,7 +1113,7 @@ find_matching_name_conf(enum maskitem_type type, const char *name, const char *u continue; if (EmptyString(conf->user) || EmptyString(conf->host)) return conf; - if (match(conf->user, user) && match(conf->host, host)) + if (!match(conf->user, user) && !match(conf->host, host)) return conf; } } @@ -1124,9 +1124,9 @@ find_matching_name_conf(enum maskitem_type type, const char *name, const char *u { conf = ptr->data; - if ((name != NULL) && match(name, conf->name)) + if ((name != NULL) && !match(name, conf->name)) return conf; - else if ((host != NULL) && match(host, conf->host)) + else if ((host != NULL) && !match(host, conf->host)) return conf; } break; @@ -1174,7 +1174,7 @@ find_exact_name_conf(enum maskitem_type type, const struct Client *who, const ch return (conf); if (EmptyString(conf->user) || EmptyString(conf->host)) return (conf); - if (match(conf->user, user) && match(conf->host, host)) + if (!match(conf->user, user) && !match(conf->host, host)) return (conf); } } @@ -1194,12 +1194,12 @@ find_exact_name_conf(enum maskitem_type type, const struct Client *who, const ch return conf; if (EmptyString(conf->user) || EmptyString(conf->host)) return NULL; - if (match(conf->user, who->username)) + if (!match(conf->user, who->username)) { switch (conf->htype) { case HM_HOST: - if (match(conf->host, who->host) || match(conf->host, who->sockhost)) + if (!match(conf->host, who->host) || !match(conf->host, who->sockhost)) if (!conf->class->max_total || conf->class->ref_count < conf->class->max_total) return conf; break; -- cgit