# HG changeset patch # User Bruno Haible # Date 1238929330 -7200 # Node ID cc6b3eba91187c36f4aca216245782adc1371551 # Parent 21aba95f1e035104636a844cfac936ded5eadd74 Use the u*_cmp functions. diff --git a/ChangeLog b/ChangeLog --- 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 --- 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 * diff --git a/lib/uninorm/u-normcmp.h b/lib/uninorm/u-normcmp.h --- 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; diff --git a/lib/uninorm/u16-normcmp.c b/lib/uninorm/u16-normcmp.c --- 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 --- 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 --- 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 --- 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: diff --git a/modules/uninorm/u32-normcmp b/modules/uninorm/u32-normcmp --- 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: diff --git a/modules/uninorm/u8-normcmp b/modules/uninorm/u8-normcmp --- 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: