From: Paul Eggert Date: Wed, 31 Aug 2005 19:55:29 +0000 (+0000) Subject: * lib/regexec.c (re_search_internal): Simplify update of X-Git-Tag: cvs-readonly~3013 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=a3bb83a2149c638ec64f53c99951dc5445e19d10;p=gnulib.git * 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. --- diff --git a/config/ChangeLog b/config/ChangeLog index 3bebac365..8a6bb3f9f 100644 --- a/config/ChangeLog +++ b/config/ChangeLog @@ -1,6 +1,6 @@ 2005-08-31 Paul Eggert - * srclist.txt: Add glibc bug 1273, 1277. + * srclist.txt: Add glibc bug 1273, 1277, 1278. 2005-08-25 Paul Eggert diff --git a/config/srclist.txt b/config/srclist.txt index 3cb3bb87f..8a410d910 100644 --- 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 @@ $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 diff --git a/lib/ChangeLog b/lib/ChangeLog index 9a1df4f68..bc743978c 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,8 @@ 2005-08-31 Paul Eggert + * 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): diff --git a/lib/regexec.c b/lib/regexec.c index 3610f5c1c..eba36c275 100644 --- a/lib/regexec.c +++ b/lib/regexec.c @@ -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);