Use the u*_cmp functions.
authorBruno Haible <bruno@clisp.org>
Sun, 5 Apr 2009 11:02:10 +0000 (13:02 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 5 Apr 2009 11:02:10 +0000 (13:02 +0200)
ChangeLog
lib/uninorm.h
lib/uninorm/u-normcmp.h
lib/uninorm/u16-normcmp.c
lib/uninorm/u32-normcmp.c
lib/uninorm/u8-normcmp.c
modules/uninorm/u16-normcmp
modules/uninorm/u32-normcmp
modules/uninorm/u8-normcmp

index bb5fc6e..1286d87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2009-04-05  Bruno Haible  <bruno@clisp.org>
 
+       * 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.
+       * lib/uninorm/u16-normcmp.c: Use u16_cmp2 instead of u16_cmp.
+       * lib/uninorm/u32-normcmp.c: Use u32_cmp2 instead of u32_cmp.
+       * modules/uninorm/u8-normcmp (Depends-on): Add unistr/u8-cmp2, remove
+       unistr/u8-cmp.
+       * modules/uninorm/u16-normcmp (Depends-on): Add unistr/u16-cmp2, remove
+       unistr/u16-cmp.
+       * modules/uninorm/u32-normcmp (Depends-on): Add unistr/u32-cmp2, remove
+       unistr/u32-cmp.
+
        New module 'unistr/u32-cmp2'.
        * lib/unistr/u32-cmp2.c: New file.
        * modules/unistr/u32-cmp2: New file.
index 869630f..5892522 100644 (file)
@@ -165,7 +165,7 @@ extern int
 
 
 /* Converts the string S of length N to a string in locale encoding, in such a
-   way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with memcmp2() is
+   way that comparing uN_normxfrm (S1) and uN_normxfrm (S2) with uN_cmp2() is
    equivalent to comparing S1 and S2 with uN_normcoll().
    NF must be either UNINORM_NFC or UNINORM_NFKC.  */
 extern char *
index 307f89b..6616440 100644 (file)
@@ -49,15 +49,8 @@ FUNC (const UNIT *s1, size_t n1, const 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 9d9c7dd..c66cc1b 100644 (file)
@@ -29,5 +29,5 @@
 #define FUNC u16_normcmp
 #define UNIT uint16_t
 #define U_NORMALIZE u16_normalize
-#define U_CMP u16_cmp
+#define U_CMP2 u16_cmp2
 #include "u-normcmp.h"
index c539c11..58f890d 100644 (file)
@@ -29,5 +29,5 @@
 #define FUNC u32_normcmp
 #define UNIT uint32_t
 #define U_NORMALIZE u32_normalize
-#define U_CMP u32_cmp
+#define U_CMP2 u32_cmp2
 #include "u-normcmp.h"
index aa8dc8e..6994f6c 100644 (file)
@@ -29,5 +29,5 @@
 #define FUNC u8_normcmp
 #define UNIT uint8_t
 #define U_NORMALIZE u8_normalize
-#define U_CMP u8_cmp
+#define U_CMP2 u8_cmp2
 #include "u-normcmp.h"
index ef15cf8..da41404 100644 (file)
@@ -8,7 +8,7 @@ lib/uninorm/u-normcmp.h
 Depends-on:
 uninorm/base
 uninorm/u16-normalize
-unistr/u16-cmp
+unistr/u16-cmp2
 minmax
 
 configure.ac:
index 276d33f..0b4f506 100644 (file)
@@ -8,7 +8,7 @@ lib/uninorm/u-normcmp.h
 Depends-on:
 uninorm/base
 uninorm/u32-normalize
-unistr/u32-cmp
+unistr/u32-cmp2
 minmax
 
 configure.ac:
index 8f1d8f2..21de0ef 100644 (file)
@@ -8,7 +8,7 @@ lib/uninorm/u-normcmp.h
 Depends-on:
 uninorm/base
 uninorm/u8-normalize
-unistr/u8-cmp
+unistr/u8-cmp2
 minmax
 
 configure.ac: