about summary refs log tree commit diff
path: root/posix/regexec.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-11-12 17:47:46 +0000
committerUlrich Drepper <drepper@redhat.com>2003-11-12 17:47:46 +0000
commit3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1 (patch)
treed993d46e33582e130e8324c5bd7fb7817d2a7f54 /posix/regexec.c
parente432c0378ecfa545948d4be68190ab470446554b (diff)
downloadglibc-3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1.tar.gz
glibc-3c0fb5745f66c8920ed4cfa8d3ead55216b15ec1.tar.xz
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/regexec.c')
-rw-r--r--posix/regexec.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/posix/regexec.c b/posix/regexec.c
index 3cd8beaba1..e962275ba3 100644
--- a/posix/regexec.c
+++ b/posix/regexec.c
@@ -605,7 +605,8 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
   fl_longest_match = (nmatch != 0 || dfa->nbackref);
 
   err = re_string_allocate (&input, string, length, dfa->nodes_len + 1,
-			    preg->translate, preg->syntax & RE_ICASE);
+			    preg->translate, preg->syntax & RE_ICASE,
+			    dfa->mb_cur_max, dfa->is_utf8);
   if (BE (err != REG_NOERROR, 0))
     goto free_return;
   input.stop = stop;
@@ -643,7 +644,7 @@ re_search_internal (preg, string, length, start, range, stop, nmatch, pmatch,
   incr = (range < 0) ? -1 : 1;
   left_lim = (range < 0) ? start + range : start;
   right_lim = (range < 0) ? start : start + range;
-  sb = MB_CUR_MAX == 1;
+  sb = dfa->mb_cur_max == 1;
   fast_translate = sb || !(preg->syntax & RE_ICASE || preg->translate);
 
   for (;;)
@@ -1018,7 +1019,7 @@ check_matching (preg, mctx, fl_search, fl_longest_match)
 	      /* Restart from initial state, since we are searching
 		 the point from where matching start.  */
 #ifdef RE_ENABLE_I18N
-	      if (MB_CUR_MAX == 1
+	      if (dfa->mb_cur_max == 1
 		  || re_string_first_byte (mctx->input, cur_str_idx))
 #endif /* RE_ENABLE_I18N */
 		cur_state = acquire_init_state_context (&err, preg, mctx,
@@ -2280,7 +2281,7 @@ transit_state_sb (err, preg, state, fl_search, mctx)
     {
 #ifdef RE_ENABLE_I18N
       int not_initial = 0;
-      if (MB_CUR_MAX > 1)
+      if (dfa->mb_cur_max > 1)
 	for (node_cnt = 0; node_cnt < next_nodes.nelem; ++node_cnt)
 	  if (dfa->nodes[next_nodes.elems[node_cnt]].type == CHARACTER)
 	    {
@@ -3772,7 +3773,7 @@ extend_buffers (mctx)
   if (pstr->icase)
     {
 #ifdef RE_ENABLE_I18N
-      if (MB_CUR_MAX > 1)
+      if (pstr->mb_cur_max > 1)
 	build_wcs_upper_buffer (pstr);
       else
 #endif /* RE_ENABLE_I18N  */
@@ -3781,7 +3782,7 @@ extend_buffers (mctx)
   else
     {
 #ifdef RE_ENABLE_I18N
-      if (MB_CUR_MAX > 1)
+      if (pstr->mb_cur_max > 1)
 	build_wcs_buffer (pstr);
       else
 #endif /* RE_ENABLE_I18N  */