changeset 6173:0728607db20f

* lib/regexec.c (re_search_internal): Simplify update of rm_so and rm_eo by replacing "if (A == B) A += C - B;" with the equivalent of "if (A == B) A = C;". This will make the code more reliable once we port to 64-bit hosts. * config/srclist.txt: Add glibc bug 1279.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 31 Aug 2005 19:55:29 +0000
parents 9fca62dc3f7d
children 6039b763ad3c
files config/ChangeLog config/srclist.txt lib/ChangeLog lib/regexec.c
diffstat 4 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,6 +1,6 @@
 2005-08-31  Paul Eggert  <eggert@cs.ucla.edu>
 
-	* srclist.txt: Add glibc bug 1273, 1277.
+	* srclist.txt: Add glibc bug 1273, 1277, 1278.
 
 2005-08-25  Paul Eggert  <eggert@cs.ucla.edu>
 
--- a/config/srclist.txt
+++ b/config/srclist.txt
@@ -1,4 +1,4 @@
-# $Id: srclist.txt,v 1.90 2005-08-31 19:40:49 eggert Exp $
+# $Id: srclist.txt,v 1.91 2005-08-31 19:55:29 eggert Exp $
 # Files for which we are not the source.  See ./srclistvars.sh for the
 # variable definitions.
 
@@ -147,6 +147,7 @@
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1241
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1245
 # http://sources.redhat.com/bugzilla/show_bug.cgi?id=1278
+# http://sources.redhat.com/bugzilla/show_bug.cgi?id=1279
 #$LIBCSRC/posix/regexec.c		lib gpl
 #
 # c89 changes $LIBCSRC/string/strdup.c		lib gpl
--- a/lib/ChangeLog
+++ b/lib/ChangeLog
@@ -1,5 +1,8 @@
 2005-08-31  Paul Eggert  <eggert@cs.ucla.edu>
 
+	* regexec.c (re_search_internal): Simplify update of rm_so and
+	rm_eo.
+
 	* regcomp.c (re_compile_fastmap_iter, init_dfa, init_word_char):
 	(optimize_subexps, lower_subexp):
 	Don't assume 1<<31 has defined behavior on hosts with 32-bit int,
@@ -7,6 +10,7 @@
 	* regex_internal.h (bitset_set, bitset_clear, bitset_contain): Likewise.
 	* regexec.c (check_dst_limits_calc_pos_1, check_subexp_matching_top):
 	Likewise.
+
 	* regcomp.c (optimize_subexps, lower_subexp):
 	Use CHAR_BIT rather than 8, for clarity.
 	* regexec.c (check_dst_limits_calc_pos_1):
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -856,14 +856,14 @@
 #ifdef RE_ENABLE_I18N
 	    if (BE (mctx.input.offsets_needed != 0, 0))
 	      {
-		if (pmatch[reg_idx].rm_so == mctx.input.valid_len)
-		  pmatch[reg_idx].rm_so += mctx.input.valid_raw_len - mctx.input.valid_len;
-		else
-		  pmatch[reg_idx].rm_so = mctx.input.offsets[pmatch[reg_idx].rm_so];
-		if (pmatch[reg_idx].rm_eo == mctx.input.valid_len)
-		  pmatch[reg_idx].rm_eo += mctx.input.valid_raw_len - mctx.input.valid_len;
-		else
-		  pmatch[reg_idx].rm_eo = mctx.input.offsets[pmatch[reg_idx].rm_eo];
+		pmatch[reg_idx].rm_so =
+		  (pmatch[reg_idx].rm_so == mctx.input.valid_len
+		   ? mctx.input.valid_raw_len
+		   : mctx.input.offsets[pmatch[reg_idx].rm_so]);
+		pmatch[reg_idx].rm_eo =
+		  (pmatch[reg_idx].rm_eo == mctx.input.valid_len
+		   ? mctx.input.valid_raw_len
+		   : mctx.input.offsets[pmatch[reg_idx].rm_eo]);
 	      }
 #else
 	    assert (mctx.input.offsets_needed == 0);