grep-commit
[Top][All Lists]
Advanced

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

grep branch, master, updated. v3.3-19-g50312b7


From: Paul Eggert
Subject: grep branch, master, updated. v3.3-19-g50312b7
Date: Tue, 5 Nov 2019 18:02:26 -0500 (EST)

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  50312b72f570609abb85fc0add7554be0ac8721e (commit)
      from  bacb70670e9ebcc0072ff50ab4888aca56ae0108 (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=50312b72f570609abb85fc0add7554be0ac8721e


commit 50312b72f570609abb85fc0add7554be0ac8721e
Author: Paul Eggert <address@hidden>
Date:   Tue Nov 5 15:01:57 2019 -0800

    grep: simplify previous patch
    
    * src/grep.c (main): Use an int rather than an enum for a local
    var, which is overkill here.

diff --git a/src/grep.c b/src/grep.c
index 142bc2f..7f3ada1 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -2432,13 +2432,9 @@ main (int argc, char **argv)
   exit_failure = EXIT_TROUBLE;
   initialize_main (&argc, &argv);
 
-  /* Command-line options for filename output.  */
-  enum
-  {
-   NO_FILENAME = -1,   /* --no-filename (-h) */
-   FILENAME_DEFAULT,   /* Neither option is specified.  */
-   WITH_FILENAME,      /* --with-filename (-H) */
-  } filename_option = FILENAME_DEFAULT;
+  /* Which command-line options have been specified for filename output.
+     -1 for -h, 1 for -H, 0 for neither.  */
+  int filename_option = 0;
 
   eolbyte = '\n';
   filename_mask = ~0;
@@ -2521,7 +2517,7 @@ main (int argc, char **argv)
         break;
 
       case 'H':
-        filename_option = WITH_FILENAME;
+        filename_option = 1;
         break;
 
       case 'I':
@@ -2613,7 +2609,7 @@ main (int argc, char **argv)
         break;
 
       case 'h':
-        filename_option = NO_FILENAME;
+        filename_option = -1;
         break;
 
       case 'i':
@@ -2904,11 +2900,9 @@ main (int argc, char **argv)
                       == out_invert);
 
   int num_operands = argc - optind;
-  out_file = (filename_option < FILENAME_DEFAULT
-              ? 0
-              : filename_option == FILENAME_DEFAULT && num_operands <= 1
+  out_file = (filename_option == 0 && num_operands <= 1
               ? - (directories == RECURSE_DIRECTORIES)
-              : 1);
+              : 0 <= filename_option);
 
   if (binary)
     xset_binary_mode (STDOUT_FILENO, O_BINARY);

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

Summary of changes:
 src/grep.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

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