changeset 11457:cc6b3eba9118

Use the u*_cmp functions.
author Bruno Haible <bruno@clisp.org>
date Sun, 05 Apr 2009 13:02:10 +0200
parents 21aba95f1e03
children 96c4e5d901b9
files 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
diffstat 9 files changed, 21 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- a/lib/uninorm.h
+++ b/lib/uninorm.h
@@ -165,7 +165,7 @@
 
 
 /* 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 *
--- a/lib/uninorm/u-normcmp.h
+++ b/lib/uninorm/u-normcmp.h
@@ -49,15 +49,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/uninorm/u16-normcmp.c
+++ b/lib/uninorm/u16-normcmp.c
@@ -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"
--- a/lib/uninorm/u32-normcmp.c
+++ b/lib/uninorm/u32-normcmp.c
@@ -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"
--- a/lib/uninorm/u8-normcmp.c
+++ b/lib/uninorm/u8-normcmp.c
@@ -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"
--- a/modules/uninorm/u16-normcmp
+++ b/modules/uninorm/u16-normcmp
@@ -8,7 +8,7 @@
 Depends-on:
 uninorm/base
 uninorm/u16-normalize
-unistr/u16-cmp
+unistr/u16-cmp2
 minmax
 
 configure.ac:
--- a/modules/uninorm/u32-normcmp
+++ b/modules/uninorm/u32-normcmp
@@ -8,7 +8,7 @@
 Depends-on:
 uninorm/base
 uninorm/u32-normalize
-unistr/u32-cmp
+unistr/u32-cmp2
 minmax
 
 configure.ac:
--- a/modules/uninorm/u8-normcmp
+++ b/modules/uninorm/u8-normcmp
@@ -8,7 +8,7 @@
 Depends-on:
 uninorm/base
 uninorm/u8-normalize
-unistr/u8-cmp
+unistr/u8-cmp2
 minmax
 
 configure.ac: