diff options
author | Paolo Bonzini <bonzini@gnu.org> | 2012-04-27 12:34:08 +0200 |
---|---|---|
committer | Paolo Bonzini <bonzini@gnu.org> | 2012-04-27 12:38:53 +0200 |
commit | 542b0b1988681b10e7d1515e2e14d414bb98790f (patch) | |
tree | 16c619beebe8f4cb9c669abee81ff27a5bf45e0c | |
parent | 55f1d964acc48273394020c55e91ca11a74530b9 (diff) | |
download | grep-542b0b1988681b10e7d1515e2e14d414bb98790f.tar.gz |
dfa: do not use hard-locale
* bootstrap.conf (gnulib_modules): Remove hard-locale.
* src/dfa.c (hard_LC_COLLATE): Remove.
(dfaparse): Do not initialize it.
(parse_bracket_exp): Always go through system regex matcher to find
single byte characters matching a range.
-rw-r--r-- | bootstrap.conf | 1 | ||||
-rw-r--r-- | src/dfa.c | 36 |
2 files changed, 13 insertions, 24 deletions
diff --git a/bootstrap.conf b/bootstrap.conf index 8c9270c9..a7853c92 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -42,7 +42,6 @@ git-version-gen gitlog-to-changelog gnu-web-doc-update gnupload -hard-locale ignore-value intprops inttypes @@ -57,7 +57,6 @@ #include "regex.h" #include "dfa.h" -#include "hard-locale.h" #include "xalloc.h" /* HPUX, define those as macros in sys/param.h */ @@ -778,7 +777,6 @@ static int laststart; /* True if we're separated from beginning or (, only by zero-width characters. */ static size_t parens; /* Count of outstanding left parens. */ static int minrep, maxrep; /* Repeat counts for {m,n}. */ -static int hard_LC_COLLATE; /* Nonzero if LC_COLLATE is hard. */ static int cur_mb_len = 1; /* Length of the multibyte representation of wctok. */ @@ -1112,26 +1110,21 @@ parse_bracket_exp (void) c1 = tolower (c1); c2 = tolower (c2); } - if (!hard_LC_COLLATE) - for (c = c1; c <= c2; c++) - setbit_case_fold_c (c, ccl); - else + + /* Defer to the system regex library about the meaning + of range expressions. */ + regex_t re; + char pattern[6] = { '[', c1, '-', c2, ']', 0 }; + char subject[2] = { 0, 0 }; + regcomp (&re, pattern, REG_NOSUB); + for (c = 0; c < NOTCHAR; ++c) { - /* Defer to the system regex library about the meaning - of range expressions. */ - regex_t re; - char pattern[6] = { '[', c1, '-', c2, ']', 0 }; - char subject[2] = { 0, 0 }; - regcomp (&re, pattern, REG_NOSUB); - for (c = 0; c < NOTCHAR; ++c) - { - subject[0] = c; - if (!(case_fold && isupper (c)) - && regexec (&re, subject, 0, NULL, 0) != REG_NOMATCH) - setbit_case_fold_c (c, ccl); - } - regfree (&re); + subject[0] = c; + if (!(case_fold && isupper (c)) + && regexec (&re, subject, 0, NULL, 0) != REG_NOMATCH) + setbit_case_fold_c (c, ccl); } + regfree (&re); } colon_warning_state |= 8; @@ -1879,9 +1872,6 @@ dfaparse (char const *s, size_t len, struct dfa *d) lasttok = END; laststart = 1; parens = 0; -#ifdef LC_COLLATE - hard_LC_COLLATE = hard_locale (LC_COLLATE); -#endif if (MB_CUR_MAX > 1) { cur_mb_len = 0; |