aboutsummaryrefslogtreecommitdiffstats
path: root/regcomp.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2016-04-11 06:06:29 +0300
committerArnold D. Robbins <arnold@skeeve.com>2016-04-11 06:06:29 +0300
commit6db77c0a45815f33b7dadb23ee6ba2c70a739345 (patch)
tree5584ed29d12643b857ceb886a51687eda14489a6 /regcomp.c
parent8ba34e95809188fb1c11fe8e581661caf7b8546f (diff)
downloadegawk-6db77c0a45815f33b7dadb23ee6ba2c70a739345.tar.gz
egawk-6db77c0a45815f33b7dadb23ee6ba2c70a739345.tar.bz2
egawk-6db77c0a45815f33b7dadb23ee6ba2c70a739345.zip
Revert 2016-01-24 change parsing single byte ranges.
Diffstat (limited to 'regcomp.c')
-rw-r--r--regcomp.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/regcomp.c b/regcomp.c
index c2fe06b1..11c94fc1 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2682,19 +2682,6 @@ parse_dup_op (bin_tree_t *elem, re_string_t *regexp, re_dfa_t *dfa,
#define BRACKET_NAME_BUF_SIZE 32
#ifndef _LIBC
-
-# ifdef RE_ENABLE_I18N
-/* Convert the byte B to the corresponding wide character. In a
- unibyte locale, treat B as itself if it is an encoding error.
- In a multibyte locale, return WEOF if B is an encoding error. */
-static wint_t
-parse_byte (unsigned char b, re_charset_t *mbcset)
-{
- wint_t wc = __btowc (b);
- return wc == WEOF && !mbcset ? b : wc;
-}
-#endif
-
/* Local function for parse_bracket_exp only used in case of NOT _LIBC.
Build the range expression which starts from START_ELEM, and ends
at END_ELEM. The result are written to MBCSET and SBCSET.
@@ -2740,10 +2727,22 @@ build_range_exp (reg_syntax_t syntax, bitset_t sbcset,
end_ch = ((end_elem->type == SB_CHAR) ? end_elem->opr.ch
: ((end_elem->type == COLL_SYM) ? end_elem->opr.name[0]
: 0));
+#ifdef GAWK
+ /*
+ * Fedora Core 2, maybe others, have broken `btowc' that returns -1
+ * for any value > 127. Sigh. Note that `start_ch' and `end_ch' are
+ * unsigned, so we don't have sign extension problems.
+ */
start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
- ? parse_byte (start_ch, mbcset) : start_elem->opr.wch);
+ ? start_ch : start_elem->opr.wch);
end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
- ? parse_byte (end_ch, mbcset) : end_elem->opr.wch);
+ ? end_ch : end_elem->opr.wch);
+#else
+ start_wc = ((start_elem->type == SB_CHAR || start_elem->type == COLL_SYM)
+ ? __btowc (start_ch) : start_elem->opr.wch);
+ end_wc = ((end_elem->type == SB_CHAR || end_elem->type == COLL_SYM)
+ ? __btowc (end_ch) : end_elem->opr.wch);
+#endif
if (start_wc == WEOF || end_wc == WEOF)
return REG_ECOLLATE;
else if (BE ((syntax & RE_NO_EMPTY_RANGES) && start_wc > end_wc, 0))