grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v2.21-34-gfa00791


From: Paul Eggert
Subject: grep branch, master, updated. v2.21-34-gfa00791
Date: Fri, 26 Jun 2015 20:35:29 +0000

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  fa007910ceb18cba349b3f8a162a2939bc2b75c8 (commit)
      from  81571c718dc064561b99e250825bd93444cec4aa (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=fa007910ceb18cba349b3f8a162a2939bc2b75c8


commit fa007910ceb18cba349b3f8a162a2939bc2b75c8
Author: Paul Eggert <address@hidden>
Date:   Fri Jun 26 13:34:51 2015 -0700

    grep: minor tweaks
    
    * src/grep.c (main): Change recently-added static vars to be
    constants, which makes them sharable.  Prefer 'return' to 'exit'
    when returning/exiting from 'main'.  Move decl closer to first use
    and rename local from 'ok' (which was confusing) to 'status'.
    Prefer named constant STDOUT_FILENO to unnamed constant 1.

diff --git a/src/grep.c b/src/grep.c
index 77ddce5..6f43284 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -2153,7 +2153,7 @@ main (int argc, char **argv)
 {
   char *keys;
   size_t keycc, oldcc, keyalloc;
-  bool with_filenames, ok;
+  bool with_filenames;
   size_t cc;
   int opt, prepended;
   int prev_optind, last_recursive;
@@ -2514,7 +2514,7 @@ main (int argc, char **argv)
     {
       version_etc (stdout, program_name, PACKAGE_NAME, VERSION, AUTHORS,
                    (char *) NULL);
-      exit (EXIT_SUCCESS);
+      return EXIT_SUCCESS;
     }
 
   if (show_help)
@@ -2579,39 +2579,38 @@ main (int argc, char **argv)
 #ifdef SET_BINARY
   /* Output is set to binary mode because we shouldn't convert
      NL to CR-LF pairs, especially when grepping binary files.  */
-  if (!isatty (1))
-    SET_BINARY (1);
+  if (!isatty (STDOUT_FILENO))
+    SET_BINARY (STDOUT_FILENO);
 #endif
 
   if (max_count == 0)
-    exit (EXIT_FAILURE);
+    return EXIT_FAILURE;
 
   if (fts_options & FTS_LOGICAL && devices == READ_COMMAND_LINE_DEVICES)
     devices = READ_DEVICES;
 
-  char **files;
+  char *const *files;
   if (optind < argc)
     {
       files = argv + optind;
     }
   else if (directories == RECURSE_DIRECTORIES && prepended < last_recursive)
     {
-      static char *cwd_only[] = { (char *) ".", NULL };
+      static char *const cwd_only[] = { (char *) ".", NULL };
       files = cwd_only;
       omit_dot_slash = true;
     }
   else
     {
-      static char *stdin_only[] = { (char *) "-", NULL };
+      static char *const stdin_only[] = { (char *) "-", NULL };
       files = stdin_only;
     }
 
-  ok = true;
+  bool status = true;
   do
-    ok &= grep_command_line_arg (*files++);
+    status &= grep_command_line_arg (*files++);
   while (*files != NULL);
 
   /* We register via atexit() to test stdout.  */
-  exit (errseen ? EXIT_TROUBLE : ok);
+  return errseen ? EXIT_TROUBLE : status;
 }
-/* vim:set shiftwidth=2: */

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

Summary of changes:
 src/grep.c |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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