This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  d8d0bf0895dccf1c541e72f7a75d3cbaf7821a05 (commit)
      from  931662604740c3b8cf2f1ed198bb1cbeff039486 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=d8d0bf0895dccf1c541e72f7a75d3cbaf7821a05


commit d8d0bf0895dccf1c541e72f7a75d3cbaf7821a05
Author: Paul Eggert <[email protected]>
Date:   Thu Jul 19 13:58:46 2012 -0700

    grep: fix ptrdiff/size_t clash
    
    Reported by Jaroslav Å karvada in <http://savannah.gnu.org/bugs/?36883>.
    * src/dfasearch.c (EGexecute): Use size_t, not ptrdiff_t, for lengths.
    Use regoff_t to store re_match's output, and test it before converting
    it to size_t.

diff --git a/src/dfasearch.c b/src/dfasearch.c
index ab30cd5..1121176 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -215,7 +215,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
   char eol = eolbyte;
   int backref;
   regoff_t start;
-  ptrdiff_t len, best_len;
+  size_t len, best_len;
   struct kwsmatch kwsm;
   size_t i, ret_val;
   mb_len_map_t *map = NULL;
@@ -343,6 +343,7 @@ EGexecute (char const *buf, size_t size, size_t *match_size,
               if (match_words)
                 while (match <= best_match)
                   {
+                    regoff_t shorter_len = 0;
                     if ((match == buf || !WCHAR ((unsigned char) match[-1]))
                         && (start + len == end - buf - 1
                             || !WCHAR ((unsigned char) match[len])))
@@ -352,13 +353,16 @@ EGexecute (char const *buf, size_t size, size_t 
*match_size,
                         /* Try a shorter length anchored at the same place. */
                         --len;
                         patterns[i].regexbuf.not_eol = 1;
-                        len = re_match (&(patterns[i].regexbuf),
-                                        buf, match + len - beg, match - buf,
-                                        &(patterns[i].regs));
-                        if (len < -1)
+                        shorter_len = re_match (&(patterns[i].regexbuf),
+                                                buf, match + len - beg,
+                                                match - buf,
+                                                &(patterns[i].regs));
+                        if (shorter_len < -1)
                           xalloc_die ();
                       }
-                    if (len <= 0)
+                    if (0 < shorter_len)
+                      len = shorter_len;
+                    else
                       {
                         /* Try looking further on. */
                         if (match == end - 1)

-----------------------------------------------------------------------

Summary of changes:
 src/dfasearch.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
grep

Reply via email to