grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.27-3-ga3721c4


From: Paul Eggert
Subject: grep branch, master, updated. v2.27-3-ga3721c4
Date: Wed, 7 Dec 2016 20:20:29 +0000 (UTC)

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  a3721c43f96beb255c533118bfaba1ddf8d9a6be (commit)
       via  136a8987b003c2cee4c2419e2bf870ff0836f8f9 (commit)
      from  c5ddfc699fa1e1da3f490b870292e0b64117aae4 (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=a3721c43f96beb255c533118bfaba1ddf8d9a6be


commit a3721c43f96beb255c533118bfaba1ddf8d9a6be
Author: Paul Eggert <address@hidden>
Date:   Wed Dec 7 12:20:04 2016 -0800

    grep: simplify finalize_input
    
    * src/grep.c (finalize_input): Simplify without changing behavior.
    It's still a bit of a rat's-nest, but it's a cozier rat's-nest.

diff --git a/src/grep.c b/src/grep.c
index 4538f22..1e910cb 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1758,29 +1758,14 @@ drain_input (int fd, struct stat const *st)
 static void
 finalize_input (int fd, struct stat const *st, bool ineof)
 {
-  if (fd != STDIN_FILENO)
-    return;
-
-  if (outleft)
-    {
-      if (ineof)
-        return;
-      if (seek_failed)
-        {
-          if (drain_input (fd, st))
-            return;
-        }
-      else if (0 <= lseek (fd, 0, SEEK_END))
-        return;
-    }
-  else
-    {
-      if (seek_failed || bufoffset == after_last_match
-          || 0 <= lseek (fd, after_last_match, SEEK_SET))
-        return;
-    }
-
-  suppressible_error (errno);
+  if (fd == STDIN_FILENO
+      && (outleft
+          ? (!ineof && (seek_failed
+                        ? ! drain_input (fd, st)
+                        : lseek (fd, 0, SEEK_END) < 0))
+          : (bufoffset != after_last_match && !seek_failed
+             && lseek (fd, after_last_match, SEEK_SET) < 0)))
+    suppressible_error (errno);
 }
 
 static bool

http://git.savannah.gnu.org/cgit/grep.git/commit/?id=136a8987b003c2cee4c2419e2bf870ff0836f8f9


commit a3721c43f96beb255c533118bfaba1ddf8d9a6be
Author: Paul Eggert <address@hidden>
Date:   Wed Dec 7 12:20:04 2016 -0800

    grep: simplify finalize_input
    
    * src/grep.c (finalize_input): Simplify without changing behavior.
    It's still a bit of a rat's-nest, but it's a cozier rat's-nest.

diff --git a/src/grep.c b/src/grep.c
index 4538f22..1e910cb 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1758,29 +1758,14 @@ drain_input (int fd, struct stat const *st)
 static void
 finalize_input (int fd, struct stat const *st, bool ineof)
 {
-  if (fd != STDIN_FILENO)
-    return;
-
-  if (outleft)
-    {
-      if (ineof)
-        return;
-      if (seek_failed)
-        {
-          if (drain_input (fd, st))
-            return;
-        }
-      else if (0 <= lseek (fd, 0, SEEK_END))
-        return;
-    }
-  else
-    {
-      if (seek_failed || bufoffset == after_last_match
-          || 0 <= lseek (fd, after_last_match, SEEK_SET))
-        return;
-    }
-
-  suppressible_error (errno);
+  if (fd == STDIN_FILENO
+      && (outleft
+          ? (!ineof && (seek_failed
+                        ? ! drain_input (fd, st)
+                        : lseek (fd, 0, SEEK_END) < 0))
+          : (bufoffset != after_last_match && !seek_failed
+             && lseek (fd, after_last_match, SEEK_SET) < 0)))
+    suppressible_error (errno);
 }
 
 static bool

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

Summary of changes:
 NEWS       |    3 ++-
 src/grep.c |   31 ++++++++-----------------------
 2 files changed, 10 insertions(+), 24 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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