changeset 31149:0fdb8889ff81

Use the new u*_cmp2 functions.
author Bruno Haible <bruno@clisp.org>
date Sun, 05 Apr 2009 13:03:09 +0200
parents 08da548e4fc9
children c214452bd61e
files ChangeLog lib/unicase.h lib/unicase/u-casecmp.h lib/unicase/u16-casecmp.c lib/unicase/u32-casecmp.c lib/unicase/u8-casecmp.c lib/unicase/ulc-casecmp.c modules/unicase/u16-casecmp modules/unicase/u32-casecmp modules/unicase/u8-casecmp modules/unicase/ulc-casecmp
diffstat 11 files changed, 25 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Apr 05 13:02:10 2009 +0200
+++ b/ChangeLog	Sun Apr 05 13:03:09 2009 +0200
@@ -1,5 +1,19 @@
 2009-04-05  Bruno Haible  <bruno@clisp.org>
 
+	* lib/unicase.h: Mention u*_cmp2.
+	* lib/unicase/u-casecmp.h (FUNC): Invoke U_CMP2 instead of U_CMP.
+	* lib/unicase/u8-casecmp.c: Use u8_cmp2 instead of u8_cmp.
+	* lib/unicase/ulc-casecmp.c: Likewise.
+	* lib/unicase/u16-casecmp.c: Use u16_cmp2 instead of u16_cmp.
+	* lib/unicase/u32-casecmp.c: Use u32_cmp2 instead of u32_cmp.
+	* modules/unicase/u8-casecmp (Depends-on): Add unistr/u8-cmp2, remove
+	unistr/u8-cmp.
+	* modules/unicase/ulc-casecmp (Depends-on): Likewise.
+	* modules/unicase/u16-casecmp (Depends-on): Add unistr/u16-cmp2, remove
+	unistr/u16-cmp.
+	* modules/unicase/u32-casecmp (Depends-on): Add unistr/u32-cmp2, remove
+	unistr/u32-cmp.
+
 	* lib/uninorm.h: Mention u*_cmp2.
 	* lib/uninorm/u-normcmp.h (FUNC): Invoke U_CMP2 instead of U_CMP.
 	* lib/uninorm/u8-normcmp.c: Use u8_cmp2 instead of u8_cmp.
--- a/lib/unicase.h	Sun Apr 05 13:02:10 2009 +0200
+++ b/lib/unicase.h	Sun Apr 05 13:03:09 2009 +0200
@@ -173,7 +173,7 @@
 		    const char *iso639_language, uninorm_t nf, int *resultp);
 
 /* Converts the string S of length N to a string in locale encoding, in such a
-   way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with memcmp2() is
+   way that comparing uN_casexfrm (S1) and uN_casexfrm (S2) with uN_cmp2() is
    equivalent to comparing S1 and S2 with uN_casecoll().
    NF must be either UNINORM_NFC, UNINORM_NFKC, or NULL for no normalization.  */
 extern char *
--- a/lib/unicase/u-casecmp.h	Sun Apr 05 13:02:10 2009 +0200
+++ b/lib/unicase/u-casecmp.h	Sun Apr 05 13:03:09 2009 +0200
@@ -54,15 +54,8 @@
     }
 
   /* Compare the normalized strings.  */
-  cmp = U_CMP (norms1, norms2, MIN (norms1_length, norms2_length));
-  if (cmp == 0)
-    {
-      if (norms1_length < norms2_length)
-	cmp = -1;
-      else if (norms1_length > norms2_length)
-	cmp = 1;
-    }
-  else if (cmp > 0)
+  cmp = U_CMP2 (norms1, norms1_length, norms2, norms2_length);
+  if (cmp > 0)
     cmp = 1;
   else if (cmp < 0)
     cmp = -1;
--- a/lib/unicase/u16-casecmp.c	Sun Apr 05 13:02:10 2009 +0200
+++ b/lib/unicase/u16-casecmp.c	Sun Apr 05 13:03:09 2009 +0200
@@ -31,5 +31,5 @@
 #define UNIT uint16_t
 #define SRC_UNIT uint16_t
 #define U_CASEFOLD u16_casefold
-#define U_CMP u16_cmp
+#define U_CMP2 u16_cmp2
 #include "u-casecmp.h"
--- a/lib/unicase/u32-casecmp.c	Sun Apr 05 13:02:10 2009 +0200
+++ b/lib/unicase/u32-casecmp.c	Sun Apr 05 13:03:09 2009 +0200
@@ -31,5 +31,5 @@
 #define UNIT uint32_t
 #define SRC_UNIT uint32_t
 #define U_CASEFOLD u32_casefold
-#define U_CMP u32_cmp
+#define U_CMP2 u32_cmp2
 #include "u-casecmp.h"
--- a/lib/unicase/u8-casecmp.c	Sun Apr 05 13:02:10 2009 +0200
+++ b/lib/unicase/u8-casecmp.c	Sun Apr 05 13:03:09 2009 +0200
@@ -31,5 +31,5 @@
 #define UNIT uint8_t
 #define SRC_UNIT uint8_t
 #define U_CASEFOLD u8_casefold
-#define U_CMP u8_cmp
+#define U_CMP2 u8_cmp2
 #include "u-casecmp.h"
--- a/lib/unicase/ulc-casecmp.c	Sun Apr 05 13:02:10 2009 +0200
+++ b/lib/unicase/ulc-casecmp.c	Sun Apr 05 13:03:09 2009 +0200
@@ -69,5 +69,5 @@
 #define UNIT uint8_t
 #define SRC_UNIT char
 #define U_CASEFOLD ulc_u8_casefold
-#define U_CMP u8_cmp
+#define U_CMP2 u8_cmp2
 #include "u-casecmp.h"
--- a/modules/unicase/u16-casecmp	Sun Apr 05 13:02:10 2009 +0200
+++ b/modules/unicase/u16-casecmp	Sun Apr 05 13:03:09 2009 +0200
@@ -9,7 +9,7 @@
 unicase/base
 unicase/u16-casefold
 uninorm/decomposing-form
-unistr/u16-cmp
+unistr/u16-cmp2
 minmax
 
 configure.ac:
--- a/modules/unicase/u32-casecmp	Sun Apr 05 13:02:10 2009 +0200
+++ b/modules/unicase/u32-casecmp	Sun Apr 05 13:03:09 2009 +0200
@@ -9,7 +9,7 @@
 unicase/base
 unicase/u32-casefold
 uninorm/decomposing-form
-unistr/u32-cmp
+unistr/u32-cmp2
 minmax
 
 configure.ac:
--- a/modules/unicase/u8-casecmp	Sun Apr 05 13:02:10 2009 +0200
+++ b/modules/unicase/u8-casecmp	Sun Apr 05 13:03:09 2009 +0200
@@ -9,7 +9,7 @@
 unicase/base
 unicase/u8-casefold
 uninorm/decomposing-form
-unistr/u8-cmp
+unistr/u8-cmp2
 minmax
 
 configure.ac:
--- a/modules/unicase/ulc-casecmp	Sun Apr 05 13:02:10 2009 +0200
+++ b/modules/unicase/ulc-casecmp	Sun Apr 05 13:03:09 2009 +0200
@@ -10,7 +10,7 @@
 unicase/u8-casefold
 uninorm/decomposing-form
 uniconv/u8-conv-from-enc
-unistr/u8-cmp
+unistr/u8-cmp2
 localcharset
 minmax