summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2010-01-04 09:07:52 +0100
committerJim Meyering <meyering@redhat.com>2010-01-04 15:44:12 +0100
commit0cfc3b87f0c3be63db1075ed465443c4b3c4cec2 (patch)
treee6f4950ecb7a9c075641eb0f034c2f45c7e4cb1c
parente138cd8fc9c9465059e9d0427d0cf0669d5a8caf (diff)
downloadgnulib-0cfc3b87f0c3be63db1075ed465443c4b3c4cec2.tar.gz
regcomp: sync from glibc; always use nl_langinfo
* lib/regcomp.c (init_dfa) [!LIBC]: Always use nl_langinfo (CODESET), now that gnulib provides it. Recognize UTF8 as well as UTF-8. * lib/regex_internal.h: Always include <langinfo.h>, now. * modules/regex (Depends-on): Add nl_langinfo.
-rw-r--r--ChangeLog7
-rw-r--r--lib/regcomp.c7
-rw-r--r--lib/regex_internal.h5
-rw-r--r--modules/regex1
4 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 272c77fc35..a69a14cc65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2010-01-04 Jim Meyering <meyering@redhat.com>
+
+ regcomp: sync from glibc; always use nl_langinfo
+ * lib/regcomp.c (init_dfa) [!LIBC]: Always use nl_langinfo (CODESET),
+ now that gnulib provides it. Recognize UTF8 as well as UTF-8.
+ * modules/regex (Depends-on): Add nl_langinfo.
+
2010-01-04 Eric Blake <ebb9@byu.net>
fdopendir: fix configure test
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 9745beab3a..3f21722367 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -850,6 +850,9 @@ static reg_errcode_t
init_dfa (re_dfa_t *dfa, size_t pat_len)
{
__re_size_t table_size;
+#ifndef _LIBC
+ char *codeset_name;
+#endif
#ifdef RE_ENABLE_I18N
size_t max_i18n_object_size = MAX (sizeof (wchar_t), sizeof (wctype_t));
#else
@@ -893,7 +896,9 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
dfa->map_notascii = (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MAP_TO_NONASCII)
!= 0);
#else
- if (strcmp (locale_charset (), "UTF-8") == 0)
+ codeset_name = nl_langinfo (CODESET);
+ if (strcasecmp (codeset_name, "UTF-8") == 0
+ || strcasecmp (codeset_name, "UTF8") == 0)
dfa->is_utf8 = 1;
/* We check exhaustively in the loop below if this charset is a
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 1f395079fe..f5c3125fbd 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -28,9 +28,8 @@
#include <stdlib.h>
#include <string.h>
-#ifdef _LIBC
-# include <langinfo.h>
-#else
+#include <langinfo.h>
+#ifndef _LIBC
# include "localcharset.h"
#endif
#if defined HAVE_LOCALE_H || defined _LIBC
diff --git a/modules/regex b/modules/regex
index c6a1235949..f51640621c 100644
--- a/modules/regex
+++ b/modules/regex
@@ -22,6 +22,7 @@ memcmp
memmove
mbrtowc
mbsinit
+nl_langinfo
stdbool
stdint
ssize_t