From: Bruno Haible Date: Sun, 5 Apr 2009 11:02:10 +0000 (+0200) Subject: Use the u*_cmp functions. X-Git-Tag: v0.1~6030 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=b298cff29e50ece882a3aea46340641f31c5b75d;p=gnulib.git Use the u*_cmp functions. --- diff --git a/ChangeLog b/ChangeLog index bb5fc6e67..1286d87ca 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2009-04-05 Bruno Haible + * 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. diff --git a/lib/uninorm.h b/lib/uninorm.h index 869630f79..5892522d5 100644 --- a/lib/uninorm.h +++ b/lib/uninorm.h @@ -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 * diff --git a/lib/uninorm/u-normcmp.h b/lib/uninorm/u-normcmp.h index 307f89b41..66164406f 100644 --- a/lib/uninorm/u-normcmp.h +++ b/lib/uninorm/u-normcmp.h @@ -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; diff --git a/lib/uninorm/u16-normcmp.c b/lib/uninorm/u16-normcmp.c index 9d9c7ddf9..c66cc1be7 100644 --- 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" diff --git a/lib/uninorm/u32-normcmp.c b/lib/uninorm/u32-normcmp.c index c539c1142..58f890d63 100644 --- 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" diff --git a/lib/uninorm/u8-normcmp.c b/lib/uninorm/u8-normcmp.c index aa8dc8e07..6994f6c5e 100644 --- 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" diff --git a/modules/uninorm/u16-normcmp b/modules/uninorm/u16-normcmp index ef15cf805..da4140499 100644 --- a/modules/uninorm/u16-normcmp +++ b/modules/uninorm/u16-normcmp @@ -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: diff --git a/modules/uninorm/u32-normcmp b/modules/uninorm/u32-normcmp index 276d33f45..0b4f50660 100644 --- a/modules/uninorm/u32-normcmp +++ b/modules/uninorm/u32-normcmp @@ -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: diff --git a/modules/uninorm/u8-normcmp b/modules/uninorm/u8-normcmp index 8f1d8f2f6..21de0ef83 100644 --- a/modules/uninorm/u8-normcmp +++ b/modules/uninorm/u8-normcmp @@ -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: