diff options
author | Karl Williamson <khw@khw-desktop.(none)> | 2010-06-05 11:12:47 -0600 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2010-06-05 23:23:59 +0200 |
commit | e6226b18246ce7d24213c41123114ac7967ed04f (patch) | |
tree | bbeecac1f9d6394373c38a61828fff2fa868ebc5 /locale.c | |
parent | d51c1b21fa08933083b4723794b68ac09a7a248b (diff) | |
download | perl-e6226b18246ce7d24213c41123114ac7967ed04f.tar.gz |
Change name of ibcmp to foldEQ
As discussed on p5p, ibcmp has different semantics from other cmp
functions in that it is a binary instead of ternary function. It is
less confusing then to have a name that implies true/false.
There are three functions affected: ibcmp, ibcmp_locale and ibcmp_utf8.
ibcmp is actually equivalent to foldNE, but for the same reason that things
like 'unless' and 'until' are cautioned against, I changed the functions
to foldEQ, so that the existing names, like ibcmp_utf8 are defined as
macros as being the complement of foldEQ.
This patch also changes the one file where turning ibcmp into a macro
causes problems. It changes it to use the new name. It also documents
for the first time ibcmp, ibcmp_locale and their new names.
Diffstat (limited to 'locale.c')
-rw-r--r-- | locale.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -522,23 +522,23 @@ Perl_init_i18nl10n(pTHX_ int printwarn) codeset = nl_langinfo(CODESET); #endif if (codeset) - utf8locale = (ibcmp(codeset, STR_WITH_LEN("UTF-8")) == 0 || - ibcmp(codeset, STR_WITH_LEN("UTF8") ) == 0); + utf8locale = (foldEQ(codeset, STR_WITH_LEN("UTF-8")) + || foldEQ(codeset, STR_WITH_LEN("UTF8") )); #if defined(USE_LOCALE) else { /* nl_langinfo(CODESET) is supposed to correctly * interpret the locale environment variables, * but just in case it fails, let's do this manually. */ if (lang) - utf8locale = (ibcmp(lang, STR_WITH_LEN("UTF-8")) == 0 || - ibcmp(lang, STR_WITH_LEN("UTF8") ) == 0); + utf8locale = (foldEQ(lang, STR_WITH_LEN("UTF-8")) + || foldEQ(lang, STR_WITH_LEN("UTF8") )); #ifdef USE_LOCALE_CTYPE if (curctype) - utf8locale = (ibcmp(curctype, STR_WITH_LEN("UTF-8")) == 0 || - ibcmp(curctype, STR_WITH_LEN("UTF8") ) == 0); + utf8locale = (foldEQ(curctype, STR_WITH_LEN("UTF-8")) + || foldEQ(curctype, STR_WITH_LEN("UTF8") )); #endif if (lc_all) - utf8locale = (ibcmp(lc_all, STR_WITH_LEN("UTF-8")) == 0 || - ibcmp(lc_all, STR_WITH_LEN("UTF8") ) == 0); + utf8locale = (foldEQ(lc_all, STR_WITH_LEN("UTF-8")) + || foldEQ(lc_all, STR_WITH_LEN("UTF8") )); } #endif /* USE_LOCALE */ if (utf8locale) |