diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-11-12 17:47:46 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-11-12 17:47:46 +0000 |
commit | 3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1 (patch) | |
tree | d993d46e33582e130e8324c5bd7fb7817d2a7f54 /posix/regex_internal.h | |
parent | e432c0378ecfa545948d4be68190ab470446554b (diff) | |
download | glibc-3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1.tar glibc-3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1.tar.gz glibc-3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1.tar.bz2 glibc-3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1.zip |
Update.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* io/ftw.c (NFTW_NEW_NAME, NFTW_OLD_NAME): Add prototypes.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/tst-regex.c (umemlen): New variable.
(test_expr): Add expectedicase argument. Test case insensitive
searches as well as backwards searches (case sensitive and
insensitive) too.
(run_test): Add icase argument. Use it to compute regcomp flags.
(run_test_backwards): New function.
(main): Cast read to size_t to avoid warning. Set umemlen.
Add expectedicase arguments to test_expr.
* posix/regex_internal.c (re_string_reconstruct): If is_utf8,
find previous character by walking back instead of converting
all chars from beginning.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/regex_internal.h (struct re_string_t): Add is_utf8
and mb_cur_max fields.
(struct re_dfa_t): Likewise. Reorder fields to make structure
smaller on 64-bit arches.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments.
(re_string_char_size_at, re_string_wchar_at): Use pstr->mb_cur_max
instead of MB_CUR_MAX.
* posix/regcomp.c (re_compile_fastmap_iter): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
(re_compile_internal): Pass new arguments to re_string_construct.
(init_dfa): Initialize mb_cur_max and is_utf8 fields.
(peek_token, peek_token_bracket): Use input->mb_cur_max instead
of MB_CUR_MAX.
(parse_expression, parse_bracket_exp, parse_charclass_op): Use
dfa->mb_cur_max instead of MB_CUR_MAX.
* posix/regex_internal.c (re_string_construct_common): Add
mb_cur_max and is_utf8 arguments. Initialize fields with them.
(re_string_allocate, re_string_construct): Add mb_cur_max and
is_utf8 arguments, pass them to re_string_construct_common.
Use mb_cur_max instead of MB_CUR_MAX.
(re_string_realloc_buffers): Use pstr->mb_cur_max instead of
MB_CUR_MAX.
(re_string_reconstruct): Likewise.
(re_string_context_at): Use input->mb_cur_max instead of
MB_CUR_MAX.
(create_ci_newstate, create_cd_newstate): Use dfa->mb_cur_max
instead of MB_CUR_MAX.
* posix/regexec.c (re_search_internal): Likewise.
Pass new arguments to re_string_allocate.
(check_matching, transit_state_sb): Use dfa->mb_cur_max instead of
MB_CUR_MAX.
(extend_buffers): Use pstr->mb_cur_max instead of MB_CUR_MAX.
2003-11-12 Jakub Jelinek <jakub@redhat.com>
* posix/Makefile (tests): Add bug-regex19.
(bug-regex19-ENV): Add LOCPATH.
* posix/bug-regex19.c: New test.
Diffstat (limited to 'posix/regex_internal.h')
-rw-r--r-- | posix/regex_internal.h | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/posix/regex_internal.h b/posix/regex_internal.h index 5e113d7c6a..40cf1f9b6a 100644 --- a/posix/regex_internal.h +++ b/posix/regex_internal.h @@ -334,6 +334,8 @@ struct re_string_t RE_TRANSLATE_TYPE trans; /* 1 if REG_ICASE. */ unsigned int icase : 1; + unsigned int is_utf8 : 1; + int mb_cur_max; }; typedef struct re_string_t re_string_t; /* In case of REG_ICASE, we allocate the buffer dynamically for mbs. */ @@ -345,10 +347,12 @@ typedef struct re_string_t re_string_t; static reg_errcode_t re_string_allocate (re_string_t *pstr, const char *str, int len, int init_len, - RE_TRANSLATE_TYPE trans, int icase); + RE_TRANSLATE_TYPE trans, int icase, + int mb_cur_max, int is_utf8); static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str, int len, RE_TRANSLATE_TYPE trans, - int icase); + int icase, int mb_cur_max, + int is_utf8); static reg_errcode_t re_string_reconstruct (re_string_t *pstr, int idx, int eflags, int newline); static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr, @@ -571,11 +575,7 @@ struct re_fail_stack_t struct re_dfa_t { re_bitset_ptr_t word_char; - - /* number of subexpressions `re_nsub' is in regex_t. */ - int subexps_alloc; re_subexp_t *subexps; - re_token_t *nodes; int nodes_alloc; int nodes_len; @@ -586,11 +586,14 @@ struct re_dfa_t re_node_set *eclosures; re_node_set *inveclosures; struct re_state_table_entry *state_table; - unsigned int state_hash_mask; re_dfastate_t *init_state; re_dfastate_t *init_state_word; re_dfastate_t *init_state_nl; re_dfastate_t *init_state_begbuf; + + /* number of subexpressions `re_nsub' is in regex_t. */ + int subexps_alloc; + unsigned int state_hash_mask; int states_alloc; int init_node; int nbackref; /* The number of backreference in this dfa. */ @@ -604,6 +607,8 @@ struct re_dfa_t a node which can accept multibyte character or multi character collating element. */ unsigned int has_mb_node : 1; + unsigned int is_utf8 : 1; + int mb_cur_max; }; typedef struct re_dfa_t re_dfa_t; @@ -700,7 +705,7 @@ re_string_char_size_at (pstr, idx) int idx; { int byte_idx; - if (MB_CUR_MAX == 1) + if (pstr->mb_cur_max == 1) return 1; for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx) if (pstr->wcs[idx + byte_idx] != WEOF) @@ -713,7 +718,7 @@ re_string_wchar_at (pstr, idx) const re_string_t *pstr; int idx; { - if (MB_CUR_MAX == 1) + if (pstr->mb_cur_max == 1) return (wint_t) pstr->mbs[idx]; return (wint_t) pstr->wcs[idx]; } |