From: Ben Pfaff Date: Sun, 31 Jul 2005 05:37:30 +0000 (+0000) Subject: (case_compare) Implement as delegating to case_compare_2dict(). X-Git-Tag: v0.4.0~22 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eeaa200a245eb4aba3a70534a198bb919c0e35c3;p=pspp-builds.git (case_compare) Implement as delegating to case_compare_2dict(). --- diff --git a/src/ChangeLog b/src/ChangeLog index a790250a..5c77f6e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +Sat Jul 30 22:36:29 2005 Ben Pfaff + + * case.c: (case_compare) Implement as delegating to + case_compare_2dict(). + Sat Jul 30 22:34:18 2005 Ben Pfaff * algorithm.c: Inclusion of is unneeded. diff --git a/src/case.c b/src/case.c index 3e35e973..fee69d4d 100644 --- a/src/case.c +++ b/src/case.c @@ -356,32 +356,9 @@ int case_compare (const struct ccase *a, const struct ccase *b, struct variable *const *vp, size_t var_cnt) { - for (; var_cnt-- > 0; vp++) - { - struct variable *v = *vp; - - if (v->width == 0) - { - double af = case_num (a, v->fv); - double bf = case_num (b, v->fv); - - if (af != bf) - return af > bf ? 1 : -1; - } - else - { - const char *as = case_str (a, v->fv); - const char *bs = case_str (b, v->fv); - int cmp = memcmp (as, bs, v->width); - - if (cmp != 0) - return cmp; - } - } - return 0; + return case_compare_2dict (a, b, vp, vp, var_cnt); } - /* Compares the values of the VAR_CNT variables in VAP in case CA to the values of the VAR_CNT variables in VBP in CB and returns a strcmp()-type result. */