From eeaa200a245eb4aba3a70534a198bb919c0e35c3 Mon Sep 17 00:00:00 2001
From: Ben Pfaff <blp@gnu.org>
Date: Sun, 31 Jul 2005 05:37:30 +0000
Subject: [PATCH] (case_compare) Implement as delegating to
 case_compare_2dict().

---
 src/ChangeLog |  5 +++++
 src/case.c    | 25 +------------------------
 2 files changed, 6 insertions(+), 24 deletions(-)

diff --git a/src/ChangeLog b/src/ChangeLog
index a790250a2f..5c77f6e9be 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jul 30 22:36:29 2005  Ben Pfaff  <blp@gnu.org>
+
+	* case.c: (case_compare) Implement as delegating to
+	case_compare_2dict().
+
 Sat Jul 30 22:34:18 2005  Ben Pfaff  <blp@gnu.org>
 
 	* algorithm.c: Inclusion of <alloca.h> is unneeded.
diff --git a/src/case.c b/src/case.c
index 3e35e973c3..fee69d4d2b 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. */
-- 
2.30.2