emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#23714: closed ([PATCH 3/6] grep: correct a stale c


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#23714: closed ([PATCH 3/6] grep: correct a stale comment and remove dead code)
Date: Fri, 19 Aug 2016 05:59:02 +0000

Your message dated Thu, 18 Aug 2016 22:58:46 -0700
with message-id <address@hidden>
and subject line Re: bug#23714: [PATCH 3/6] grep: correct a stale comment and 
remove dead code
has caused the debbugs.gnu.org bug report #23714,
regarding [PATCH 3/6] grep: correct a stale comment and remove dead code
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
23714: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=23714
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: [PATCH 3/6] grep: correct a stale comment and remove dead code Date: Tue, 7 Jun 2016 01:37:40 -0500
* src/grep.c (grepdesc): The `grep()' function no longer has
special-case negative return values, since it no longer handles
directories, so don't bother checking for them.
---
 src/grep.c | 61 +++++++++++++++++++++++++++----------------------------------
 1 file changed, 27 insertions(+), 34 deletions(-)

diff --git a/src/grep.c b/src/grep.c
index 9776507..4fa56cf 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1396,9 +1396,7 @@ grepbuf (char *beg, char const *lim)
   return outleft0 - outleft;
 }
 
-/* Search a given file.  Normally, return a count of lines printed;
-   but if the file is a directory and we search it recursively, then
-   return -2 if there was a match, and -1 otherwise.  */
+/* Search a given (non-directory) file.  Return a count of lines printed. */
 static intmax_t
 grep (int fd, struct stat const *st)
 {
@@ -1767,42 +1765,37 @@ grepdesc (int desc, bool command_line)
 #endif
 
   count = grep (desc, &st);
-  if (count < 0)
-    status = count + 2;
-  else
+  if (count_matches)
     {
-      if (count_matches)
-        {
-          if (out_file)
-            {
-              print_filename ();
-              if (filename_mask)
-                print_sep (SEP_CHAR_SELECTED);
-              else
-                putchar_errno (0);
-            }
-          printf_errno ("%" PRIdMAX "\n", count);
-          if (line_buffered)
-            fflush_errno ();
-        }
-
-      status = !count;
-      if (list_files == 1 - 2 * status)
+      if (out_file)
         {
           print_filename ();
-          putchar_errno ('\n' & filename_mask);
-          if (line_buffered)
-            fflush_errno ();
+          if (filename_mask)
+            print_sep (SEP_CHAR_SELECTED);
+          else
+            putchar_errno (0);
         }
+      printf_errno ("%" PRIdMAX "\n", count);
+      if (line_buffered)
+        fflush_errno ();
+    }
 
-      if (desc == STDIN_FILENO)
-        {
-          off_t required_offset = outleft ? bufoffset : after_last_match;
-          if (required_offset != bufoffset
-              && lseek (desc, required_offset, SEEK_SET) < 0
-              && S_ISREG (st.st_mode))
-            suppressible_error (filename, errno);
-        }
+  status = !count;
+  if (list_files == 1 - 2 * status)
+    {
+      print_filename ();
+      putchar_errno ('\n' & filename_mask);
+      if (line_buffered)
+        fflush_errno ();
+    }
+
+  if (desc == STDIN_FILENO)
+    {
+      off_t required_offset = outleft ? bufoffset : after_last_match;
+      if (required_offset != bufoffset
+          && lseek (desc, required_offset, SEEK_SET) < 0
+          && S_ISREG (st.st_mode))
+        suppressible_error (filename, errno);
     }
 
  closeout:
-- 
2.8.0.rc3




--- End Message ---
--- Begin Message --- Subject: Re: bug#23714: [PATCH 3/6] grep: correct a stale comment and remove dead code Date: Thu, 18 Aug 2016 22:58:46 -0700 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0
Thanks; this was installed in June so I am closing the bug report.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]