* lib/regexec.c (re_search_internal): Simplify update of
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 31 Aug 2005 19:55:29 +0000 (19:55 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 31 Aug 2005 19:55:29 +0000 (19:55 +0000)
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.

config/ChangeLog
config/srclist.txt
lib/ChangeLog
lib/regexec.c

index 3bebac3..8a6bb3f 100644 (file)
@@ -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>
 
index 3cb3bb8..8a410d9 100644 (file)
@@ -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 @@ $LIBCSRC/stdlib/getsubopt.c         lib gpl
 # 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
index 9a1df4f..bc74397 100644 (file)
@@ -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):
index 3610f5c..eba36c2 100644 (file)
@@ -856,14 +856,14 @@ re_search_internal (const regex_t *preg,
 #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);