Use the new u*_cmp2 functions.
authorBruno Haible <bruno@clisp.org>
Sun, 5 Apr 2009 11:03:09 +0000 (13:03 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 5 Apr 2009 11:03:09 +0000 (13:03 +0200)
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

index 1286d87..786634f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
index 9f37a6b..73d2c07 100644 (file)
@@ -173,7 +173,7 @@ extern int
                    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 *
index 8ae23d7..e1cf99c 100644 (file)
@@ -54,15 +54,8 @@ FUNC (const SRC_UNIT *s1, size_t n1, const SRC_UNIT *s2, size_t n2,
     }
 
   /* 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;
index b4777f5..1110874 100644 (file)
@@ -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"
index a691c43..e964915 100644 (file)
@@ -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"
index b7e250a..4a55de9 100644 (file)
@@ -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"
index b337ee2..c061b24 100644 (file)
@@ -69,5 +69,5 @@ ulc_u8_casefold (const char *s, size_t n, const char *iso639_language,
 #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"
index a2d7ee0..ec5a60b 100644 (file)
@@ -9,7 +9,7 @@ Depends-on:
 unicase/base
 unicase/u16-casefold
 uninorm/decomposing-form
-unistr/u16-cmp
+unistr/u16-cmp2
 minmax
 
 configure.ac:
index 21b5bcf..9c0ce1d 100644 (file)
@@ -9,7 +9,7 @@ Depends-on:
 unicase/base
 unicase/u32-casefold
 uninorm/decomposing-form
-unistr/u32-cmp
+unistr/u32-cmp2
 minmax
 
 configure.ac:
index 521ccdc..b4fdba8 100644 (file)
@@ -9,7 +9,7 @@ Depends-on:
 unicase/base
 unicase/u8-casefold
 uninorm/decomposing-form
-unistr/u8-cmp
+unistr/u8-cmp2
 minmax
 
 configure.ac:
index 618ae28..ad1b96d 100644 (file)
@@ -10,7 +10,7 @@ unicase/base
 unicase/u8-casefold
 uninorm/decomposing-form
 uniconv/u8-conv-from-enc
-unistr/u8-cmp
+unistr/u8-cmp2
 localcharset
 minmax