summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorGravatar Lucien Van Elsen <lwvanels@mit.edu>1992-02-13 02:40:18 +0000
committerGravatar Lucien Van Elsen <lwvanels@mit.edu>1992-02-13 02:40:18 +0000
commit92dc2c7aa552223b8851f040d14f71a5fac47ab8 (patch)
treecd47a8b8480d91a69613f2e3186e52b9b577a5e6 /server
parent5ac9be28dafb81f4eb0f8779cfbd818e6e180adc (diff)
fix compare_subs to deal with wildcards correctly
and still maintain sort order.
Diffstat (limited to 'server')
-rw-r--r--server/subscr.c24
1 files changed, 9 insertions, 15 deletions
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));