From: Ben Pfaff Date: Sat, 20 Dec 2003 00:28:58 +0000 (+0000) Subject: Fri Dec 19 16:23:45 2003 Ben Pfaff X-Git-Tag: v0.4.0~419 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc18840c1952a016935b95b8a139dd70f1ec619e;p=pspp-builds.git Fri Dec 19 16:23:45 2003 Ben Pfaff * matrix-data.c (compare_variables_by_mxd_vartype): Rewrite. --- diff --git a/src/ChangeLog b/src/ChangeLog index c6e60018..f00fddfd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +Fri Dec 19 16:23:45 2003 Ben Pfaff + + * matrix-data.c (compare_variables_by_mxd_vartype): Rewrite. + Fri Dec 19 15:54:45 2003 Ben Pfaff * expr-prs.c: (cmp_func) Removed. diff --git a/src/matrix-data.c b/src/matrix-data.c index 538074d0..b2adcd4a 100644 --- a/src/matrix-data.c +++ b/src/matrix-data.c @@ -680,14 +680,17 @@ string_to_content_type (char *s, int *collide) /* Compare two variables using p.mxd.vartype and p.mxd.subtype fields. */ static int -compare_variables_by_mxd_vartype (const void *pa, const void *pb) +compare_variables_by_mxd_vartype (const void *a_, const void *b_) { - struct matrix_data_proc *a = &(*((struct variable **) pa))->p.mxd; - struct matrix_data_proc *b = &(*((struct variable **) pb))->p.mxd; - - return (a->vartype != b->vartype - ? a->vartype - b->vartype - : a->subtype - b->subtype); + struct variable *const *pa = a_; + struct variable *const *pb = b_; + const struct matrix_data_proc *a = &(*pa)->p.mxd; + const struct matrix_data_proc *b = &(*pb)->p.mxd; + + if (a->vartype != b->vartype) + return a->vartype > b->vartype ? 1 : -1; + else + return a->subtype < b->subtype ? -1 : a->subtype > b->subtype; } #if DEBUGGING