Mercurial > gnulib
changeset 16950:87796549f866
regex: use locale-independent comparison for codeset name
See Bruno Haible's comment in <http://bugs.gnu.org/10305#120>.
* lib/regcomp.c (init_dfa): Use just ASCII case comparison
for codeset name.
* lib/regex_internal.h: Do not include <strings.h>, since we
no longer use strcasecmp.
* modules/regex (Depends-on): Remove strcase.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Tue, 26 Jun 2012 15:16:07 -0700 |
parents | 6c13c6060f77 |
children | 9009d83acea4 |
files | ChangeLog lib/regcomp.c lib/regex_internal.h modules/regex |
diffstat | 4 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jun 26 19:53:01 2012 +0200 +++ b/ChangeLog Tue Jun 26 15:16:07 2012 -0700 @@ -1,3 +1,13 @@ +2012-06-26 Paul Eggert <eggert@cs.ucla.edu> + + regex: use locale-independent comparison for codeset name + See Bruno Haible's comment in <http://bugs.gnu.org/10305#120>. + * lib/regcomp.c (init_dfa): Use just ASCII case comparison + for codeset name. + * lib/regex_internal.h: Do not include <strings.h>, since we + no longer use strcasecmp. + * modules/regex (Depends-on): Remove strcase. + 2012-06-23 Bruno Haible <bruno@clisp.org> getopt-posix: No longer guarantee that option processing is resettable.
--- a/lib/regcomp.c Tue Jun 26 19:53:01 2012 +0200 +++ b/lib/regcomp.c Tue Jun 26 15:16:07 2012 -0700 @@ -899,8 +899,10 @@ != 0); #else codeset_name = nl_langinfo (CODESET); - if (strcasecmp (codeset_name, "UTF-8") == 0 - || strcasecmp (codeset_name, "UTF8") == 0) + if ((codeset_name[0] == 'U' || codeset_name[0] == 'u') + && (codeset_name[1] == 'T' || codeset_name[1] == 't') + && (codeset_name[2] == 'F' || codeset_name[2] == 'f') + && strcmp (codeset_name + 3 + (codeset_name[3] == '-'), "8") == 0) dfa->is_utf8 = 1; /* We check exhaustively in the loop below if this charset is a
--- a/lib/regex_internal.h Tue Jun 26 19:53:01 2012 +0200 +++ b/lib/regex_internal.h Tue Jun 26 15:16:07 2012 -0700 @@ -24,7 +24,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <strings.h> #include <langinfo.h> #ifndef _LIBC
--- a/modules/regex Tue Jun 26 19:53:01 2012 +0200 +++ b/modules/regex Tue Jun 26 15:16:07 2012 -0700 @@ -26,7 +26,6 @@ nl_langinfo [test $ac_use_included_regex = yes] stdbool [test $ac_use_included_regex = yes] stdint [test $ac_use_included_regex = yes] -strcase [test $ac_use_included_regex = yes] wchar [test $ac_use_included_regex = yes] wcrtomb [test $ac_use_included_regex = yes] wctype-h [test $ac_use_included_regex = yes]