diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-01-06 22:12:27 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-01-06 22:12:27 +0000 |
commit | f39eef7b5d2539cffa1149b0bbeb75f513a4ace3 (patch) | |
tree | edd3ba0bd193eb8d2fac9099b073db01badd2488 /posix/regex_internal.c | |
parent | (regcomp): Fix comment typo. (regfree): Free preg->translate, clear buffer, a... (diff) | |
download | glibc-f39eef7b5d2539cffa1149b0bbeb75f513a4ace3.tar.gz glibc-f39eef7b5d2539cffa1149b0bbeb75f513a4ace3.tar.bz2 glibc-f39eef7b5d2539cffa1149b0bbeb75f513a4ace3.zip |
Update.
2004-01-05 Jakub Jelinek <jakub@redhat.com>
* posix/regcomp.c (regcomp): Fix comment typo.
(regfree): Free preg->translate, clear buffer, allocated, fastmap
and translate fields.
* posix/regcomp.c (build_charclass, buld_charclass_op): Change first
argument to unsigned RE_TRANSLATE_TYPE.
* posix/regex_internal.h (re_string_t): Change trans type to
unsigned RE_TRANSLATE_TYPE.
* posix/regex_internal.c (re_string_construct_common): Cast
trans to unsigned RE_TRANSLATE_TYPE.
(re_string_peek_byte_case, re_string_fetch_byte_case): Avoid fast
path if pstr->trans. Never translate the character through
pstr->trans.
* posix/Makefile (tests): Add bug-regex22.
(bug-regex22-ENV): Set.
* posix/bug-regex22.c: New test.
Diffstat (limited to 'posix/regex_internal.c')
-rw-r--r-- | posix/regex_internal.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/posix/regex_internal.c b/posix/regex_internal.c index ee386709d9..ed26908ad1 100644 --- a/posix/regex_internal.c +++ b/posix/regex_internal.c @@ -189,7 +189,7 @@ re_string_construct_common (str, len, pstr, trans, icase, dfa) pstr->raw_mbs = (const unsigned char *) str; pstr->len = len; pstr->raw_len = len; - pstr->trans = trans; + pstr->trans = (unsigned RE_TRANSLATE_TYPE) trans; pstr->icase = icase ? 1 : 0; pstr->mbs_allocated = (trans != NULL || icase); pstr->mb_cur_max = dfa->mb_cur_max; @@ -758,7 +758,7 @@ re_string_peek_byte_case (pstr, idx) int ch, off; /* Handle the common (easiest) cases first. */ - if (BE (!pstr->icase, 1)) + if (BE (!pstr->mbs_allocated, 1)) return re_string_peek_byte (pstr, idx); #ifdef RE_ENABLE_I18N @@ -774,8 +774,6 @@ re_string_peek_byte_case (pstr, idx) #endif ch = pstr->raw_mbs[pstr->raw_mbs_idx + off]; - if (pstr->trans) - ch = pstr->trans[ch]; #ifdef RE_ENABLE_I18N /* Ensure that e.g. for tr_TR.UTF-8 BACKSLASH DOTLESS SMALL LETTER I @@ -793,15 +791,13 @@ static unsigned char re_string_fetch_byte_case (pstr) re_string_t *pstr; { - int ch; - - if (BE (!pstr->icase, 1)) + if (BE (!pstr->mbs_allocated, 1)) return re_string_fetch_byte (pstr); #ifdef RE_ENABLE_I18N if (pstr->offsets_needed) { - int off; + int off, ch; /* For tr_TR.UTF-8 [[:islower:]] there is [[: CAPITAL LETTER I WITH DOT lower:]] in mbs. Skip @@ -815,8 +811,6 @@ re_string_fetch_byte_case (pstr) off = pstr->offsets[pstr->cur_idx]; ch = pstr->raw_mbs[pstr->raw_mbs_idx + off]; - if (pstr->trans) - ch = pstr->trans[ch]; if (! isascii (ch)) return re_string_fetch_byte (pstr); @@ -827,10 +821,7 @@ re_string_fetch_byte_case (pstr) } #endif - ch = pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++]; - if (pstr->trans) - ch = pstr->trans[ch]; - return ch; + return pstr->raw_mbs[pstr->raw_mbs_idx + pstr->cur_idx++]; } static void |