Subject: bug#17599: closed (Re: bug#17599: [PATCH] grep: removal of an unnecessary argument)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 26 May 2014 16:09:03 +0000

Your bug report

#17599: [PATCH] grep: removal of an unnecessary argument

which was filed against the grep package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
17599: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17599
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#17599: [PATCH] grep: removal of an unnecessary argument
From: Paul Eggert <[email-masked]>
To: Norihiro Tanaka <[email-masked]>, [email-masked]
Date: Mon, 26 May 2014 09:07:57 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

Thanks, I installed that.

Subject: [PATCH] grep: removal of an unnecessary argument
From: Norihiro Tanaka <[email-masked]>
To: [email-masked]
Date: Mon, 26 May 2014 23:39:05 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

`start_ptr' which is 4th argument is always null in do_execute().  So
remove it to simplify.  This patch doesn't change behaviour of grep.
From c3e044c24ccc25fa5733afcdcad9af00532e6523 Mon Sep 17 00:00:00 2001
From: Norihiro Tanaka <[email-masked]>
Date: Fri, 16 May 2014 18:44:59 +0900
Subject: [PATCH] grep: removal of an unnecessary argument

* src/grep (do_execute): Remove argument `start_ptr'.  It's always null.
(grepbuf): Fix a caller of it.
---
 src/grep.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/grep.c b/src/grep.c
index 6a2a029..acc08c7 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1052,8 +1052,7 @@ prtext (char const *beg, char const *lim)
    is no match, return (size_t) -1.  Otherwise, set *MATCH_SIZE to the
    length of the match and return the offset of the start of the match.  */
 static size_t
-do_execute (char const *buf, size_t size, size_t *match_size,
-            char const *start_ptr)
+do_execute (char const *buf, size_t size, size_t *match_size)
 {
   size_t result;
   const char *line_next;
@@ -1072,7 +1071,7 @@ do_execute (char const *buf, size_t size, size_t *match_size,
      return buf + size otherwise.  */
   if (! (execute == Fexecute || execute == Pexecute)
       || MB_CUR_MAX == 1 || !match_icase)
-    return execute (buf, size, match_size, start_ptr);
+    return execute (buf, size, match_size, NULL);
 
   for (line_next = buf; line_next < buf + size; )
     {
@@ -1084,10 +1083,7 @@ do_execute (char const *buf, size_t size, size_t *match_size,
       else
         line_next = line_end + 1;
 
-      if (start_ptr && start_ptr >= line_end)
-        continue;
-
-      result = execute (line_buf, line_next - line_buf, match_size, start_ptr);
+      result = execute (line_buf, line_next - line_buf, match_size, NULL);
       if (result != (size_t) -1)
         return (line_buf - buf) + result;
     }
@@ -1108,7 +1104,7 @@ grepbuf (char const *beg, char const *lim)
   for (p = beg; p < lim; p = endp)
     {
       size_t match_size;
-      size_t match_offset = do_execute (p, lim - p, &match_size, NULL);
+      size_t match_offset = do_execute (p, lim - p, &match_size);
       if (match_offset == (size_t) -1)
         {
           if (!out_invert)
-- 
1.9.3