From 92dc2c7aa552223b8851f040d14f71a5fac47ab8 Mon Sep 17 00:00:00 2001 From: Lucien Van Elsen Date: Thu, 13 Feb 1992 02:40:18 +0000 Subject: fix compare_subs to deal with wildcards correctly and still maintain sort order. --- server/subscr.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'server/subscr.c') diff --git a/server/subscr.c b/server/subscr.c index 7a02f5c..a2885ce 100644 --- a/server/subscr.c +++ b/server/subscr.c @@ -1305,8 +1305,6 @@ compare_subs(s1,s2,do_wildcard) ZSubscr_t *s1, *s2; int do_wildcard; { - int neq; - int sub_is_wildcard; #if 0 zdbug((LOG_DEBUG,"compare_subs: %s/%s/%s to %s/%s/%s", @@ -1315,25 +1313,21 @@ compare_subs(s1,s2,do_wildcard) #endif /* wildcard must be in s2 in order for it to match */ - if (do_wildcard) - sub_is_wildcard = (s2->zst_dest.inst == wildcard_instance); - else - sub_is_wildcard = 0; + if (do_wildcard && (s1->zst_dest.classname == s2->zst_dest.classname) && + (s2->zst_dest.inst == wildcard_instance) && + (s1->zst_dest.recip == s2->zst_dest.recip)) + return(0); - if (!sub_is_wildcard) { - if (s1->zst_dest.hash_value > s2->zst_dest.hash_value) - return 1; - if (s1->zst_dest.hash_value < s2->zst_dest.hash_value) - return -1; - } + if (s1->zst_dest.hash_value > s2->zst_dest.hash_value) + return 1; + if (s1->zst_dest.hash_value < s2->zst_dest.hash_value) + return -1; if (s1->zst_dest.classname != s2->zst_dest.classname) return(strcasecmp(s1->zst_dest.classname->string, s2->zst_dest.classname->string)); - neq = (s1->zst_dest.inst != s2->zst_dest.inst); - if ((!do_wildcard && neq) || - (!sub_is_wildcard && neq)) + if (s1->zst_dest.inst != s2->zst_dest.inst) return(strcasecmp(s1->zst_dest.inst->string, s2->zst_dest.inst->string)); -- cgit v1.2.3