summaryrefslogtreecommitdiff
path: root/posix/regex_internal.h
AgeCommit message (Collapse)Author
2009-01-08Updated to fedora-glibc-20090108T1017cvs/fedora-glibc-2_9_90-2Jakub Jelinek
2009-01-02Updated to fedora-glibc-20090102T2110cvs/fedora-glibc-2_9_90-1Jakub Jelinek
2007-08-27Updated to fedora-glibc-20070827T2032Jakub Jelinek
2005-12-19Updated to fedora-glibc-20051219T1003cvs/fedora-glibc-2_3_90-19Jakub Jelinek
2005-10-20Updated to fedora-glibc-20051020T0651Jakub Jelinek
2005-10-03Updated to fedora-glibc-20051003T2040Jakub Jelinek
2005-09-12Updated to fedora-glibc-20050912T0656Jakub Jelinek
2005-05-20Updated to fedora-glibc-20050520T0919Jakub Jelinek
2005-03-03Updated to fedora-glibc-20050302T1820Jakub Jelinek
2005-02-08Updated to fedora-glibc-20050208T0948cvs/fedora-glibc-2_3_4-6Jakub Jelinek
2005-01-06Updated to fedora-glibc-20050106T1443Jakub Jelinek
2004-12-10Updated to fedora-glibc-20041210T0634Jakub Jelinek
2004-12-07Updated to fedora-glibc-20041207T1331Jakub Jelinek
2004-11-26Updated to fedora-glibc-20041126T1318cvs/fedora-glibc-2_3_3-85Jakub Jelinek
2004-11-19Updated to fedora-glibc-20041119T0003Jakub Jelinek
2004-11-12Updated to fedora-glibc-20041112T1640Jakub Jelinek
2004-11-10Updated to fedora-glibc-20041110T0839Jakub Jelinek
2004-02-26Update.Ulrich Drepper
2004-02-24 Arnold D. Robbins <arnold@skeeve.com> * posix/regex_internal.c (build_wcs_upper_buffer): Enclose `offsets_needed' label in `#ifdef _LIBC' to silence `unused label' compiler warning. 2004-02-24 Nelson H.F. Beebe <beebe@math.utah.edu> * posix/regex_internal.c (build_wcs_buffer): Add cast to char* in call to `wcrtomb'. * posix/regex_internal.h (bitset_not, bitset_merge, bitset_not_merge, bitset_mask, re_string_char_size_a, re_string_wchar_at, re_string_elem_size_at): Change to use prototypes. (re_string_char_size_at, re_string_wchar_at, re_string_elem_size_at): Declare as `internal_function'.
2004-01-30Update.Ulrich Drepper
2004-01-28 Paolo Bonzini <bonzini@gnu.org> Merge regex changes in gawk. * posix/regcomp.c (build_range_exp) [!_LIBC]: Check validity of collation elements. * posix/regex.c: Include limits.h. * posix/regex.h: Document REG_ECOLLATE correctly. * posix/regex_internal.h [!_LIBC && !ENABLE_NLS]: Disable NLS.
2004-01-14Update.Ulrich Drepper
2004-01-13 Ulrich Drepper <drepper@redhat.com> * posix/regex.c: Support crappy compilers and platforms which have problems with alloca. * posix/regex_internal.h: Likewise. Patch by Paolo Bonzini.
2004-01-14Update.Ulrich Drepper
2004-01-14 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c (peek_token_bracket): Check remaining string length before re_string_peek_byte (x, 1). (parse_bracket_symbol): Likewise. * posix/regex_internal.h (re_string_is_single_byte_char): Return true at last byte in the string. * posix/bug-regex22.c (main): Add new test.
2004-01-06Update.Ulrich Drepper
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.
2004-01-03(re_match_context_t): Add dfa member.Andreas Jaeger
2004-01-02Update.Ulrich Drepper
2004-01-02 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.c (re_node_set_insert): Remove unused variables. * posix/regex_internal.h (re_dfa_t): Add syntax field. * posix/regcomp.c (parse): Initialize dfa->syntax. * posix/regexec.c (acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_state_context, proceed_next_node, sift_states_iter_mb, sift_states_backward, update_cur_sifted_state, sift_states_bkref, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, check_arrival, expand_bkref_cache, build_trtable): Remove preg argument, add dfa argument instead and remove dfa = preg->buffer initialization in the body. Adjust all callers. (check_node_accept_bytes, group_nodes_into_DFAstates, check_node_accept): Likewise. Use dfa->syntax instead of preg->syntax. (check_arrival_add_next_nodes): Remove preg argument. * posix/regex_internal.h (re_match_context_t): Make input re_string_t instead of a pointer to it. * posix/regex_internal.c (re_string_construct_common): Don't clear pstr here... (re_string_construct): ... but only here. * posix/regexec.c (match_ctx_init): Remove input argument. Don't initialize fields to zero. (re_search_internal): Move input into mctx.input. (acquire_init_state_context, check_matching, check_halt_state_context, proceed_next_node, clean_state_log_if_needed, sift_states_bkref, sift_states_iter_mb, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, check_arrival, check_arrival_add_next_nodes, check_node_accept, extend_buffers): Change mctx->input into &mctx->input and mctx->input->field into mctx->input.field. 2004-01-02 Jakub Jelinek <jakub@redhat.com> Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_const_bitset_ptr_t): New type. (re_string_t): Add newline_anchor, word_char and word_ops_used fields. (re_dfa_t): Change word_char type to bitset. Add word_ops_used field. (re_string_context_at, re_string_reconstruct): Remove last argument. * posix/regex_internal.c (re_string_allocate): Initialize pstr->word_char and pstr->word_ops_used. (re_string_context_at): Remove newline_anchor argument. Use input->newline_anchor instead, swap && conditions. Only use IS_WIDE_WORD_CHAR if input->word_ops_used != 0. Use input->word_char bitmap instead of IS_WORD_CHAR. (re_string_reconstruct): Likewise. Adjust re_string_context_at caller. * posix/regexec.c (acquire_init_state_context, check_halt_state_context, transit_state, transit_state_sb, transit_state_mb, transit_state_bkref, check_arrival, check_node_accept): Adjust re_string_context_at and re_string_reconstruct callers. (re_search_internal): Likewise. Set input.newline_anchor. (build_trtable): Use dfa->word_char bitmap instead of IS_WORD_CHAR. * posix/regcomp.c (init_word_char): Change return type to void. Set dfa->word_ops_used. (free_dfa_content): Don't free dfa->word_char. (parse_expression): Remove error handling for init_word_char.
2004-01-02Update.Ulrich Drepper
2004-01-01 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h (re_dfastate_t): Fix size of the CONTEXT bitfield. * posix/regex_internal.c (re_node_set_insert): Rewrite.
2003-12-27Update.Ulrich Drepper
2003-12-23 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.c (re_dfa_add_node): Initialize opt_subexp. * posix/regex_internal.h (re_token_type_t): Put OP_DUP_PLUS among the tokens, rather than among the epsilon-transiting nodes. (re_token_t): Add the opt_subexp flag. * posix/regcomp.c (optimize_utf8, calc_first, calc_next, calc_epsdest): Don't consider OP_DUP_PLUS. (mark_opt_subexp, mark_opt_subexp_iter): New functions. (parse_dup_op): Mostly rewritten, lowering OP_DUP_PLUS to OP_DUP_ASTERISK and marking optional subexpressions as such using mark_opt_subexp. * posix/regexec.c (set_regs): Initialize PREV_INDEX_MATCH and pass it to update_regs. (update_regs): Use the PREV_INDEX_MATCH parameter, together with the opt_subexp flag, in order to discard a final empty match of a repeated subexpression. * posix/BOOST.tests: Adjust test vectors. * posix/PCRE.tests: Likewise. * posix/rxspencer/tests: Likewise. 2003-12-17 Paolo Bonzini <bonzini@gnu.org> 2003-12-16 Paolo Bonzini <bonzini@gnu.org> 2003-12-17 Paolo Bonzini <bonzini@gnu.org> 2003-12-16 Jakub Jelinek <jakub@redhat.com> 2003-04-06 Kaz Kojima <kkojima@rr.iij4u.or.jp> 2003-02-20 Paolo Bonzini <bonzini@gnu.org> 2003-01-12 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> 2003-01-09 Richard Henderson <rth@redhat.com> 2003-01-09 Richard Henderson <rth@redhat.com> 2003-01-03 Paul Eggert <eggert@twinsun.com>
2003-12-23Update.Ulrich Drepper
2003-12-22 Jakub Jelinek <jakub@redhat.com> * posix/regcomp.c: Remove C99-ism. * posix/tst-rxspencer.c: Likewise. Based on a patch by Alex Davis <alex14641@yahoo.com>. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regex_internal.h [!_LIBC] (internal_function): Define. (re_string_allocate, re_string_construct, re_string_reconstruct, re_string_realloc_buffers, build_wcs_buffer, build_wcs_upper_buffer, build_upper_buffer, re_string_translate_buffer, re_string_destruct, re_string_elem_size_at, re_string_char_size_at, re_string_wchar_at, re_string_context_at, re_node_set_alloc, re_node_set_init_1 re_node_set_init_2, re_node_set_init_copy, re_node_set_add_intersect, re_node_set_init_union, re_node_set_merge, re_node_set_insert re_node_set_compare, re_node_set_contains re_node_set_remove_at, re_dfa_add_node, re_acquire_state, re_acquire_state_context, free_state): Add internal_function to declaration. * posix/regexec.c (match_ctx_init, match_ctx_clean, match_ctx_free, match_ctx_free_subtops, match_ctx_add_entry, search_cur_bkref_entry, match_ctx_clear_flag, match_ctx_add_subtop, match_ctx_add_sublast, sift_ctx_init, re_search_internal, re_search_2_stub, re_search_stub, re_copy_regs, acquire_init_state_context, prune_impossible_nodes, check_matching, check_halt_node_context, check_halt_state_context update_regs, proceed_next_node, push_fail_stack, pop_fail_stack, set_regs, free_fail_stack_return, sift_states_iter_mb, sift_states_backward update_cur_sifted_state, add_epsilon_src_nodes, sub_epsilon_src_nodes, check_dst_limits, check_dst_limits_calc_pos, check_subexp_limits, sift_states_bkref, clean_state_log_if_need, merge_state_array, transit_state, check_subexp_matching_top, transit_state_sb, transit_state_mb, transit_state_bkref, get_subexp, get_subexp_sub, find_subexp_node, check_arrival, check_arrival_add_next_nodes, find_collation_sequence_value, check_arrival_expand_ecl, check_arrival_expand_ecl_sub, expand_bkref_cache, build_trtable, check_node_accept_bytes, extend_buffers, group_nodes_into_DFAstates, check_node_accept): Likewise. * posix/regex_internal.c (re_string_construct_common, re_string_skip_chars, create_newstate_common, register_state, create_ci_newstate, create_cd_newstate, calc_state_hash): Likewise. (re_string_peek_byte_case, re_fetch_byte_case): Change declaration from ANSI to K&R. 2002-12-16 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (build_trtable): Don't allocate the trtable until state->word_trtable is known. Don't hardcode UINT_BITS iterations on each bitset item.
2003-12-16Update.Ulrich Drepper
2003-12-16 Petter Reinholdtsen <pere@hungry.com> * posix/regex_internal.h: Make sure the regex code compile with non-GCC compilers by hiding attributes.
2003-11-29Update.Ulrich Drepper
2003-11-28 Ulrich Drepper <drepper@redhat.com> * sysdeps/x86_64/fpu/libm-test-ulps: Add some more minor changes to compensate other setup. 2003-11-27 Andreas Jaeger <aj@suse.de> * sysdeps/x86_64/fpu/libm-test-ulps: Add ulps for new atan2 test. * math/libm-test.inc (atan2_test): Add test that run infinitly. Reported by "Willus" <etc231etc231@willus.com>. 2003-11-27 Michael Matz <matz@suse.de> * sysdeps/ieee754/dbl-64/mpsqrt.c (fastiroot): Fix 64-bit problem with wrong types. 2003-11-28 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (acquire_init_state_context): Make inline. Add always_inline attribute. (check_matching): Add BE macro. Move if (cur_state->has_backref) into if (dfa->nbackref). (sift_states_backward): Fix comment. (transit_state): Add BE macro. Move if (next_state->has_backref) into if (dfa->nbackref && next_state). Don't check for next_state != NULL twice. * posix/regcomp.c (peek_token): Use opr.ctx_type instead of opr.idx for ANCHOR. (parse_expression): Only call init_word_char if word context will be needed. * posix/bug-regex11.c (tests): Add new tests. * posix/tst-regex.c: Include getopt.h. (timing): New variable. (main): Set timing to 1 if --timing argument is present. Add 2 new tests. (run_test, run_test_backwards): Handle timing. 2003-11-27 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_string_t): Remove mbs_case field. Add offsets, valid_raw_len, raw_len, raw_stop, mbs_allocated and offsets_needed fields. Change icase, is_utf8 and map_notascii type from int bitfield to unsigned char. (MBS_ALLOCATED, MBS_CASE_ALLOCATED): Remove. (build_wcs_upper_buffer): Change prototype to return int. (re_string_peek_byte_case, re_string_fetch_byte_case): Remove defines, add prototypes. * posix/regex_internal.c (re_string_allocate): Don't initialize stop here. Don't initialize mbs_case. Set valid_raw_len. Use mbs_allocated instead of MBS_* macros. (re_string_construct): Don't initialize stop and valid_len here. Don't initialize mbs_case. Use mbs_allocated instead of MBS_* macros. Reallocate buffers if build_wcs_upper_buffer converted too few bytes. Set valid_len to bufs_len only for single byte no translation and set in that case valid_raw_len as well. (re_string_realloc_buffers): Reallocate offsets if not NULL. Use mbs_allocated instead of MBS_ALLOCATED. Don't reallocate mbs_case. (re_string_construct_common): Initialize raw_len, mbs_allocated, stop and raw_stop. (build_wcs_buffer): Apply pstr->trans before mbrtowc instead of after it. Set valid_raw_len. Don't set mbs_case. (build_wcs_upper_buffer): Return REG_NOERROR or REG_ESPACE. Only use the fast path if !pstr->offsets_needed. Apply pstr->trans before mbrtowc instead of after it. If upper case character uses different number of bytes than lower case, goto to the slow path. Don't call towupper unnecessarily twice. Set valid_raw_len as well. Handle in the slow path the case if lower and upper case use different number of characters. Don't set mbs_case. (re_string_skip_chars): Use valid_raw_len instead of valid_len. (build_upper_buffer): Don't set mbs_case. Add BE macro. Set valid_raw_len. (re_string_translate_buffer): Set mbs instead of mbs_case. Set valid_raw_len. (re_string_reconstruct): Use raw_len/raw_stop to initialize len/stop. Clear valid_raw_len and offsets_needed when clearing valid_len. Use mbs_allocated instead of MBS_* macros. Check original offset against valid_raw_len instead of valid_len. Remove mbs_case handling. Adjust valid_raw_len together with valid_len. If is_utf8 and looking for tip context, apply pstr->trans first. If buffers start with partial multi-byte character, initialize mbs array as well if mbs_allocated. Check return value of build_wcs_upper_buffer. (re_string_peek_byte_case): New function. (re_string_fetch_byte_case): New function. (re_string_destruct): Use mbs_allocated instead of MBS_ALLOCATED. Don't free mbs_case. Free offsets. * posix/regcomp.c (init_dfa): Only check if charset name is UTF-8 if mb_cur_max == 6. * posix/regexec.c (re_search_internal): Initialize input.raw_stop as well. Use valid_raw_len instead of valid_len when looking through fastmap. Adjust registers through input.offsets. (extend_buffers): Allow build_wcs_upper_buffer to fail. * posix/bug-regex18.c (tests): Enable #ifdefed out tests. Add new tests.
2003-11-24Update.Ulrich Drepper
2003-11-24 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_token_t): Add word_char bit. Add comment. (re_dfa_t): Add sb_char field. (bitset_mask): New function. * posix/regcomp.c (free_dfa_content): Free sb_char. (init_dfa): Don't initialize word_char unnecessarily. Initialize sb_char. (duplicate_node): Don't duplicate !word_char CHARACTERs with NEXT_WORD_CONSTRAINT constraint or word_char CHARACTERs with NEXT_NOTWORD_CONSTRAINT. Return -1 in *new_idx instead. (duplicate_node_closure): Handle clone_dest == -1 from duplicate_node. (peek_token): Initialize word_char bit. (parse_expression, parse_dup_op): Add comments. (parse_bracket_exp): Don't set bitmask bits for multi-byte char starting bytes here at the beginning. Mask off the bits right before creating SIMPLE_BRACKET. (build_charclass_op): Likewise. * posix/regexec.c (group_nodes_into_DFAstates) <case OP_PERIOD>: Only set accept bits for single-byte characters. (group_nodes_into_DFAstates): Don't rely on characters 0 .. 127 being single byte encoded and the rest multi-byte. * posix/bug-regex19.c (tests): Add new tests. (do_mb_tests): Initialize t to *test. (main): Fail even on do_mb_tests errors.
2003-11-23Update.Ulrich Drepper
2003-11-23 Ulrich Drepper <drepper@redhat.com> * posix/regexec.c: Add const in a number of places. * posix/regex_internal.h: Make EPSILON_BIT a macro to help debugging. Its value isn't important.
2003-11-20Update.Ulrich Drepper
2003-11-20 Ulrich Drepper <drepper@redhat.com> * posix/PTESTS: Fix first test in GA143. 2003-11-20 Jakub Jelinek <jakub@redhat.com> * posix/regex_internal.h (re_dfastate_t): Remove trtable_search. Add word_trtable. * posix/regex_internal.c (create_newstate_common, free_state): Don't free trtable_search. * posix/regexec.c (check_matching): Remove fl_search argument. (transit_state_sb): Likewise. #ifdef out as unused. (build_trtable): Remove fl_search argument. Set state->word_trtable and state->trtable. Build separate word and non-word tables if multi-byte and they differ for some character. (transit_state): Remove fl_search argument. Don't update state->trtable here. Handle state->word_trtable. #ifdef out unused call to transit_state_sb. (re_search_internal): Update check_matching caller. (group_nodes_into_DFAstates): Don't clear non-ascii chars in accepts bitmask for multi-byte locales. * posix/bug-regex19.c (tests): Enable some commented out tests, add 2 new tests. * posix/tst-rxspencer.c (mb_tests): Don't test [[=b=]] for now as multi-byte. Don't run identical multi-byte tests multiple times unnecessarily. (main): Check setlocale return value. * posix/Makefile (tst-rxspencer-ARGS): Add --utf8 argument. (tst-rxspencer-ENV): Remove MALLOC_TRACE, add LOCPATH. ($(objpfx)tst-rxspencer-mem): Run another tst-rxspencer test here, without --utf8 argument but with MALLOC_TRACE.
2003-11-19Update.Ulrich Drepper
2003-11-19 Jakub Jelinek <jakub@redhat.com> * posix/regexec.c (extend_buffers): Don't allocate twice as big state_log as needed. Don't modify pstr->valid_len for mb_cur_max == 1 !icase !trans. * posix/regcomp.c (free_bin_tree): Removed. (create_tree): Add dfa argument. Don't call re_malloc for each tree, instead allocate from str_tree_storage. (re_dfa_add_tree_node): New function. (free_dfa_content): Handle freeing if dfa->nodes == NULL or dfa->state_table == NULL. (re_compile_internal): Call free_dfa_content if init_dfa fails. Call free_workarea_compile, re_string_destruct and free_dfa_content for most of the other failure paths. (init_dfa): Initialize str_tree_storage_idx. Don't clear any fields on allocation failure. (free_workarea_compile): Free str_tree_storage chunks instead of free_bin_tree (dfa->str_tree). (parse): Call re_dfa_add_tree_node instead of re_dfa_add_node followed by create_tree. Add dfa argument to remaining create_tree calls. Remove new_idx variable. Remove calls to free_bin_tree. (parse_reg_exp, parse_branch, parse_expression, parse_sub_exp, parse_dup_op, parse_bracket_exp, build_charclass_op): Likewise. (duplicate_tree): Remove calls to free_bin_tree, add dfa argument to create_tree. * posix/regex_internal.h (BIN_TREE_STORAGE_SIZE): Define. (bin_tree_storage_t): New type. (re_dfa_t): Add str_tree_storage and str_tree_storage_idx fields. * posix/Makefile (tests): Add bug-regex21. (generated): Add bug-regex21-mem, bug-regex21.mtrace, tst-rxspencer-mem and tst-rxspencer.mtrace. (tests): Depend on $(objpfx)bug-regex21-mem and $(objpfx)tst-rxspencer-mem. (bug-regex21-ENV, tst-rxspencer-ENV): Set. ($(objpfx)bug-regex21-mem, $(objpfx)tst-rxspencer-mem): New. * posix/tst-rxspencer.c (main): Add call to mtrace. Free line at the end. * posix/bug-regex21.c: New test. * posix/regexec.c (get_subexp): After calling get_subexp_sub
2003-11-19Update.Ulrich Drepper
2003-11-19 Ulrich Drepper <drepper@redhat.com> * posix/regex_internal.h (re_string_first_byte): Use ->valid_len not ->len. (re_string_is_single_byte_char): Likewise. * posix/regexec.c (get_subexp): After calling get_subexp_seb
2003-11-18Update.Ulrich Drepper
* posix/regex_internal.h (re_token_type_t): Remove unused ALT, END_OF_RE_TOKEN_T and SUBEXP. Reorder values. Add OP_UTF8_PERIOD and EPSILON_BIT. (IS_EPSILON_NODE): Just test if EPSILON_BIT is set. (ACCEPT_MB_NODE): Return 1 for OP_UTF8_PERIOD as well. * posix/regex_internal.c (create_ci_newstate, create_cd_newstate): Handle OP_UTF8_PERIOD. (re_string_reconstruct): Set valid_len for single byte char searching with no translation and case sensitivity. * posix/regcomp.c (re_compile_fastmap_iter, calc_first): Handle OP_UTF8_PERIOD. (re_compile_internal): Don't call optimize_utf8 if preg->translate != NULL. (optimize_utf8): Remove BACK_SLASH case. Transform OP_PERIOD into OP_UTF8_PERIOD if the searching can be optimized. (parse_bracket_exp): Don't create SIMPLE_BRACKET if it doesn't have any bits set and COMPLEX_BRACKET is used. * posix/regexec.c (transit_state_mb): Fix comment typo. (group_nodes_into_DFAstates, check_node_accept): Handle OP_UTF8_PERIOD. (check_node_accept_bytes): Likewise. Reorder slightly so that re_string_char_size_at and re_string_elem_size_at are called only when needed. * posix/bug-regex20.c (BRE, ERE): Define. (tests): Use them to make lines shorter. Expect . to be optimized. Add lots of new tests. (main): Run (ATM just case sensitive) test with backwards searching as well. 2003-11-18 Jakub Jelinek <jakub@redhat.com>
2003-11-16Update.Ulrich Drepper
* posix/regex_internal.h: Add forward declaration of re_dfa_t. Replace last two parameters of re_string_allocate and re_string_construct with pointer to DFA. (re_dfa_t): Add map_notascii field. * posix/regcomp.c (re_compile_internal): Add call of re_string_construct. (init_dfa): Initialize mpa_notascii. * posix/regex_internal.c: Adjust definitions of re_string_allocate and re_string_construct. Pass DFA to re_string_construct. Adjust definition. Initialize map_notascii field. (build_wcs_upper_buffer): If map_notascii is zero use simplfied method to map ASCII values to upper case. * posix/regex.c: Include localeinfo.h. * posix/regexec.c: Adjust call of re_string_allocate. * locale/langinfo.h: Add _NL_CTYPE_MAP_TO_NONASCII. * locale/localeinfo.h (LIMAGIC): Change value. * locale/categories.def. Add entry for _NL_CTYPE_MAP_TO_NONASCII. * locale/C-ctype.h: Likewise. * locale/programs/ld-ctype.c: Compute whether any mapping maps from ASCII to non-ASCII value. Write out that value.
2003-11-12Update.Ulrich Drepper
* posix/regcomp.c (optimize_utf8): New function. (re_compile_fastmap_iter): Use dfa->mb_cur_max > 1 instead of !icase. (re_compile_internal): Call optimize_utf8 if not case insensitive and in UTF-8 locale. * posix/regex_internal.h: Ifdef out some prototypes if RE_NO_INTERNAL_PROTOTYPES is defined to shut up warnings. * posix/Makefile (tests): Add bug-regex20. (bug-regex20-ENV): Add LOCPATH. * posix/bug-regex20.c: New test. 2003-11-12 Jakub Jelinek <jakub@redhat.com>
2003-11-12Update.Ulrich Drepper
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.
2003-11-11(re_string_char_size_at): Don't look beyond valid_len wide chars.Ulrich Drepper
2003-09-23Update.Ulrich Drepper
* posix/regcomp.c (build_word_op): Rename like... (build_charclass_op): ...this. Accept two extra parameters, CLASS_NAME and EXTRA. Add EXTRA to the result, not only _. (peek_token): accept \s and \S as OP_SPACE and OP_NOTSPACE. (parse_expression): replace build_word_op with build_charclass_op, add new arguments, accept OP_SPACE and OP_NOTSPACE. * posix/regex_internal.h (re_token_type_t): Add OP_SPACE and OP_NOTSPACE.
2003-09-23Upate.Ulrich Drepper
2003-09-20 Paolo Bonzini <bonzini@gnu.org> * posix/regcomp.c (peek_token): Don't look back for ( or | to check whether to treat a caret as special. It fails for the (extended) regex \(^. (parse, parse_reg_exp): Pass RE_CARET_ANCHORS_HERE to fetch_token. * posix/regex.h: Define RE_CARET_ANCHORS_HERE. * posix/regexec.c: Check out of bounds value before shifting. * posix/regex_internal.h: Define __attribute for non-gcc.
2003-02-23Update.Ulrich Drepper
* posix/Makefile (CFLAGS-regex.c): Remove RE_ENABLE_I18N definition. * posix/regex_internal.h (RE_ENABLE_I18N): Pretty printing.
2003-02-21Update.Ulrich Drepper
* inet/rcmd.c (rresvport_af): Avoid using invliad values. Wrap around in search if port IPPORT_RESERVED/2 has been test. 2002-02-20 Paolo Bonzini <bonzini@gnu.org> * posix/regcomp.c: Remove inclusions. * posix/regexec.c: Likewise. * posix/regex_internal.c: Likewise. * posix/regex_internal.h: Add inclusions here. * posix/regex.c: Only include sys/types.h before regex.h. Include regex_internal.h here. Include regex_internal.c before regcomp.c and regexec.c (might expose more opportunities to the C compiler). * posix/regcomp.c (parse_expression): Fix construct rejected by SGI CC. * posix/regex_internal.h [!_LIBC] (__mempcpy): Fix typo. [!_LIBC] (__wcrtomb): New definition. [!_LIBC]: Conditionalize enabling of I18N on HAVE_WCSCOLL and HAVE_LOCALE_H as well. 2003-02-20 Ulrich Drepper <drepper@redhat.com>
2002-12-17Update.Ulrich Drepper
2002-12-17 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (free_workarea_compile): Free the new member ORG_INDICES. (analyze): Initialize ORG_INDICES. (duplicate_node_closure): Search for a existing node, which is duplicated from the node ORG_DEST and satisfies the constraint CONSTRAINT. And use it to avoid inifimite loop. (search_duplicated_node): New function. (duplicate_node): Store the index of the original node. * posix/regex_internal.c (re_dfa_add_node): Realloc ORG_INDICES if needed. * posix/regex_internal.h (re_dfa_t): Add new members.
2002-11-27Update.Ulrich Drepper
2002-11-27 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (parse_expression): Set the bit since the back reference is used in the regular expression. * posix/regex_internal.c (re_node_set_init_1): Make it clean in case of malloc failure. (re_node_set_init_copy): Likewise. * posix/regex_internal.h (state_array_t): New structure. (re_sub_match_last_t): Likewise. (re_sub_match_top_t): Likewise. (re_match_context_t): Add new members. (re_dfa_t): Likewise. * posix/regexec.c (re_search_internal): Invoke prune_impossible_nodes to check the matching is really correct, and retry if failed. Move the routin pruning the impossible nodes from here, ... (prune_impossible_nodes): To this function. (check_matching): Invoke check_subexp_matching_top, and replace redundant checking with transit_state_bkref invocation. (proceed_next_node): Replace strncmp with memcmp. Reported by Paolo Bonzini <bonzini@gnu.org>. (update_cur_sifted_state): Remove search_subexp invocation. (search_subexp): Remove this function. (check_dst_limits_calc_pos): Use search_cur_bkref_entry for optimization. (sift_states_bkref): Use search_cur_bkref_entry for optimization. Remove unused invocation of match_ctx_add_entry. (transit_state): Invoke check_subexp_matching_top. (check_subexp_matching_top): New function. (transit_state_bkref): Remove unused array. Merge transit_state_bkref_loop. (transit_state_bkref_loop): Use get_subexp instead of sift_states_backward. Use search_cur_bkref_entry for optimization. Merge this function to transit_state_bkref. (get_subexp): New function. (get_subexp_sub): Likewise. (find_subexp_node): Likewise. (check_arrival): Likewise. (check_arrival_expand_ecl): Likewise. (check_arrival_expand_ecl_sub): Likewise. (expand_bkref_cache): Likewise. (match_ctx_init): Initialize new members. (match_ctx_clean): New function. (match_ctx_free): Release new members. (match_ctx_free_subtops): New function. (match_ctx_add_entry): Fix indent. (search_cur_bkref_entry): New function. (match_ctx_add_subtop): Likewise. (match_ctx_add_sublast): Likewise.
2002-11-13* posix/regex_internal.c (re_string_skip_chars): Also return the lastRoland McGrath
wide character. (re_string_reconstruct): Calculate the context by itself when the offset points out of the valid range. (re_string_context_at): Use wide character when MB_CUR_MAX > 1. * posix/regex_internal.h (WIDE_NEWLINE_CHAR): New macro. (IS_WIDE_WORD_CHAR): New macro. (IS_WIDE_NEWLINE): New macro.
2002-11-06Update.Ulrich Drepper
2002-11-06 Ulrich Drepper <drepper@redhat.com> * posix/regcomp.c: Use tabs instead of spaces. * posix/regexec.c: Likewise. * posix/regex_internal.h: Likewise. * posix/regcomp.c (re_compile_fastmap_iter): Use __wcrtomb not wctomb.
2002-10-12Update.Ulrich Drepper
2002-10-11 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regcomp.c (re_compile_fastmap_iter): Remove the handling OP_CONTEXT_NODE. (regfree): Likewise. (create_initial_state): Likewise. (analyze): Remove the substitutions which became useless. (calc_first): Likewise. (calc_epsdest): Use edests of OP_BACK_REF in case that it has epsilon destination. (duplicate_node_closure): New function. (duplicate_node): Remove the handling OP_CONTEXT_NODE. (calc_inveclosure): Likewise. (calc_eclosure): Likewise. (calc_eclosure_iter): Invoke duplicate_node_closure instead of direct invocation of duplicate_node. (parse): Don't use comma operator in the return to avoid compiler warning. (parse_reg_exp): Likewise. (parse_branch): Likewise. (parse_expression): Likewise. (parse_sub_exp): Likewise. (parse_dup_op): Likewise. * posix/regex_internal.c (re_dfa_add_node): Remove the substitutions which became useless. (create_ci_newstate): Remove the handling OP_CONTEXT_NODE. (create_cd_newstate): Likewise. * posix/regex_internal.h (re_token_type_t): Remove the obsolete type. (re_token_t): Likewise. (re_dfa_t): Likewise. (re_node_set_remove): New macro. * posix/regexec.c (check_matching): Remove the handling OP_CONTEXT_NODE. (check_halt_node_context): Likewise. (proceed_next_node): Likewise. (pop_fail_stack): Fix the memory leak. (set_regs): Likewise. (free_fail_stack_return): New function. (sift_states_backward): Fix the memory leak. Remove the handling OP_CONTEXT_NODE. (update_cur_sifted_state): Append some if clause to avoid redundant call. (sub_epsilon_src_nodes): Use IS_EPSILON_NODE since it might be a back reference. (check_dst_limits): Remove the handling OP_CONTEXT_NODE. (check_subexp_limits): Likewise. (search_subexp): Likewise. (sift_states_bkref): Likewise. (transit_state_mb): Likewise. (transit_state_bkref_loop): Likewise. (transit_state_bkref_loop): Likewise. (group_nodes_into_DFAstates): Likewise. (check_node_accept): Likewise. (sift_ctx_init): Add initializing. 2002-10-12 Ulrich Drepper <drepper@redhat.com> * sysdeps/unix/sysv/linux/i386/sysdep.h (INLINE_SYSCALL): Use __builtin_expect.
2002-09-30Update.Ulrich Drepper
2002-09-30 Isamu Hasegawa <isamu@yamato.ibm.com> * posix/regex_internal.h (re_match_context_t): Add a new member. (re_fail_stack_ent_t): New structure. (re_fail_stack_t): Likewise. * posix/regexec.c (re_search_internal): Use the new member of re_match_context_t. Use fail stack only if it has back references and there are plural matching candidates. (proceed_next_node): Use fail stack if it is indicated. (set_regs): Likewise. (push_fail_stack): New function. (pop_fail_stack): New function. (check_dst_limits): Likewise. (check_dst_limits_calc_pos): Likewise. (search_subexp): Check the limitations on the top of subexpressions. (sift_states_bkref): Check the limitations of the destination node. Reuse the array sctx->sifted_states. 2002-09-30 Ulrich Drepper <drepper@redhat.com> * stdio-common/printf_fp.c: Shuffle a few lines around to help the compiler optimizing. No semantical changes intended.
2002-09-28Update.Ulrich Drepper
2002-09-27 Ulrich Drepper <drepper@redhat.com> * locales/zh_TW: Use shorter forms for abday and day. Patch by Rex Tsai <chihchun@kalug.linux.org.tw>.