1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
* 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>
This commit is contained in:
Ulrich Drepper
2003-12-16 06:16:27 +00:00
parent a0a8461cf9
commit c0d5034ed1
4 changed files with 31 additions and 8 deletions

View File

@ -1,3 +1,14 @@
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> 2003-12-14 Paolo Bonzini <bonzini@gnu.org>
* posix/regex_internal.c (re_acquire_state_context): * posix/regex_internal.c (re_acquire_state_context):

View File

@ -406,8 +406,11 @@ re_compile_fastmap_iter (bufp, init_state, fastmap)
} }
} }
#endif /* RE_ENABLE_I18N */ #endif /* RE_ENABLE_I18N */
else if (type == END_OF_RE || type == OP_PERIOD else if (type == OP_PERIOD
|| type == OP_UTF8_PERIOD) #ifdef RE_ENABLE_I18N
|| type == OP_UTF8_PERIOD
#endif /* RE_ENABLE_I18N */
|| type == END_OF_RE)
{ {
memset (fastmap, '\1', sizeof (char) * SBC_MAX); memset (fastmap, '\1', sizeof (char) * SBC_MAX);
if (type == END_OF_RE) if (type == END_OF_RE)

View File

@ -786,7 +786,7 @@ re_string_peek_byte_case (const re_string_t *pstr,
static unsigned char static unsigned char
re_string_fetch_byte_case (re_string_t *pstr) re_string_fetch_byte_case (re_string_t *pstr)
{ {
int ch, off; int ch;
if (BE (!pstr->icase, 1)) if (BE (!pstr->icase, 1))
return re_string_fetch_byte (pstr); return re_string_fetch_byte (pstr);
@ -794,6 +794,8 @@ re_string_fetch_byte_case (re_string_t *pstr)
#ifdef RE_ENABLE_I18N #ifdef RE_ENABLE_I18N
if (pstr->offsets_needed) if (pstr->offsets_needed)
{ {
int off;
/* For tr_TR.UTF-8 [[:islower:]] there is /* For tr_TR.UTF-8 [[:islower:]] there is
[[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip [[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip
in that case the whole multi-byte character and return in that case the whole multi-byte character and return

View File

@ -807,6 +807,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
for (reg_idx = 0; reg_idx < nmatch; ++reg_idx) for (reg_idx = 0; reg_idx < nmatch; ++reg_idx)
if (pmatch[reg_idx].rm_so != -1) if (pmatch[reg_idx].rm_so != -1)
{ {
#ifdef RE_ENABLE_I18N
if (BE (input.offsets_needed != 0, 0)) if (BE (input.offsets_needed != 0, 0))
{ {
if (pmatch[reg_idx].rm_so == input.valid_len) 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 else
pmatch[reg_idx].rm_eo = input.offsets[pmatch[reg_idx].rm_eo]; 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_so += match_first;
pmatch[reg_idx].rm_eo += 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->state_log = backup_state_log;
mctx->input->cur_idx = backup_cur_idx; 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. */ /* Then check the current node set has the node LAST_NODE. */
return (re_node_set_contains (cur_nodes, last_node) if (cur_nodes != NULL && re_node_set_contains (cur_nodes, last_node))
|| re_node_set_contains (cur_nodes, last_node) ? REG_NOERROR return REG_NOERROR;
: REG_NOMATCH);
return REG_NOMATCH;
} }
/* Helper functions for check_arrival. */ /* 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) if (preg->syntax & RE_DOT_NOT_NULL)
bitset_clear (accepts, '\0'); bitset_clear (accepts, '\0');
} }
#ifdef RE_ENABLE_I18N
else if (type == OP_UTF8_PERIOD) else if (type == OP_UTF8_PERIOD)
{ {
memset (accepts, 255, sizeof (unsigned int) * BITSET_UINTS / 2); 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) if (preg->syntax & RE_DOT_NOT_NULL)
bitset_clear (accepts, '\0'); bitset_clear (accepts, '\0');
} }
#endif
else else
continue; continue;
@ -3820,10 +3825,12 @@ check_node_accept (preg, node, mctx, idx)
return node->opr.c == ch; return node->opr.c == ch;
case SIMPLE_BRACKET: case SIMPLE_BRACKET:
return bitset_contain (node->opr.sbcset, ch); return bitset_contain (node->opr.sbcset, ch);
#ifdef RE_ENABLE_I18N
case OP_UTF8_PERIOD: case OP_UTF8_PERIOD:
if (ch >= 0x80) if (ch >= 0x80)
return 0; return 0;
/* FALLTHROUGH */ /* FALLTHROUGH */
#endif
case OP_PERIOD: case OP_PERIOD:
return !((ch == '\n' && !(preg->syntax & RE_DOT_NEWLINE)) return !((ch == '\n' && !(preg->syntax & RE_DOT_NEWLINE))
|| (ch == '\0' && (preg->syntax & RE_DOT_NOT_NULL))); || (ch == '\0' && (preg->syntax & RE_DOT_NOT_NULL)));