diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | posix/regcomp.c | 7 | ||||
-rw-r--r-- | posix/regex_internal.c | 4 | ||||
-rw-r--r-- | posix/regexec.c | 17 |
4 files changed, 31 insertions, 8 deletions
@@ -1,5 +1,16 @@ 2003-12-14 Paolo Bonzini <bonzini@gnu.org> + * posix/regexec.c (check_arrival): Remove duplicate test. + +2003-12-15 Ulrich Drepper <drepper@redhat.com> + + * posix/regcomp.c: Make !RE_ENABLE_I18N work again. + * posix/regex_internal.c: Likewise. + * posix/regexec.c: Likewise. + Patch by Paolo Bonzini. + +2003-12-14 Paolo Bonzini <bonzini@gnu.org> + * posix/regex_internal.c (re_acquire_state_context): Compare the node sets after all the other comparisons. diff --git a/posix/regcomp.c b/posix/regcomp.c index bdcc59d..1c7bd71 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -406,8 +406,11 @@ re_compile_fastmap_iter (bufp, init_state, fastmap) } } #endif /* RE_ENABLE_I18N */ - else if (type == END_OF_RE || type == OP_PERIOD - || type == OP_UTF8_PERIOD) + else if (type == OP_PERIOD +#ifdef RE_ENABLE_I18N + || type == OP_UTF8_PERIOD +#endif /* RE_ENABLE_I18N */ + || type == END_OF_RE) { memset (fastmap, '\1', sizeof (char) * SBC_MAX); if (type == END_OF_RE) diff --git a/posix/regex_internal.c b/posix/regex_internal.c index b9b2d3a..ed377eb 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -786,7 +786,7 @@ re_string_peek_byte_case (const re_string_t *pstr, static unsigned char re_string_fetch_byte_case (re_string_t *pstr) { - int ch, off; + int ch; if (BE (!pstr->icase, 1)) return re_string_fetch_byte (pstr); @@ -794,6 +794,8 @@ re_string_fetch_byte_case (re_string_t *pstr) #ifdef RE_ENABLE_I18N if (pstr->offsets_needed) { + int off; + /* For tr_TR.UTF-8 [[:islower:]] there is [[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip in that case the whole multi-byte character and return diff --git a/posix/regexec.c b/posix/regexec.c index d8b4b0d..731b49d 100644 --- a/posix/regexec.c +++ b/posix/regexec.c @@ -807,6 +807,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) if (pmatch[reg_idx].rm_so != -1) { +#ifdef RE_ENABLE_I18N if (BE (input.offsets_needed != 0, 0)) { if (pmatch[reg_idx].rm_so == input.valid_len) @@ -818,6 +819,9 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch, else pmatch[reg_idx].rm_eo = input.offsets[pmatch[reg_idx].rm_eo]; } +#else + assert (input.offsets_needed == 0); +#endif pmatch[reg_idx].rm_so += match_first; pmatch[reg_idx].rm_eo += match_first; } @@ -2815,12 +2819,11 @@ check_arrival (preg, mctx, path, top_node, top_str, last_node, last_str, mctx->state_log = backup_state_log; mctx->input->cur_idx = backup_cur_idx; - if (cur_nodes == NULL) - return REG_NOMATCH; /* Then check the current node set has the node LAST_NODE. */ - return (re_node_set_contains (cur_nodes, last_node) - || re_node_set_contains (cur_nodes, last_node) ? REG_NOERROR - : REG_NOMATCH); + if (cur_nodes != NULL && re_node_set_contains (cur_nodes, last_node)) + return REG_NOERROR; + + return REG_NOMATCH; } /* Helper functions for check_arrival. */ @@ -3365,6 +3368,7 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) if (preg->syntax & RE_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } +#ifdef RE_ENABLE_I18N else if (type == OP_UTF8_PERIOD) { memset (accepts, 255, sizeof (unsigned int) * BITSET_UINTS / 2); @@ -3373,6 +3377,7 @@ group_nodes_into_DFAstates (preg, state, dests_node, dests_ch) if (preg->syntax & RE_DOT_NOT_NULL) bitset_clear (accepts, '\0'); } +#endif else continue; @@ -3820,10 +3825,12 @@ check_node_accept (preg, node, mctx, idx) return node->opr.c == ch; case SIMPLE_BRACKET: return bitset_contain (node->opr.sbcset, ch); +#ifdef RE_ENABLE_I18N case OP_UTF8_PERIOD: if (ch >= 0x80) return 0; /* FALLTHROUGH */ +#endif case OP_PERIOD: return !((ch == '\n' && !(preg->syntax & RE_DOT_NEWLINE)) || (ch == '\0' && (preg->syntax & RE_DOT_NOT_NULL))); |