Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/indent indent: eliminate unused variable



details:   https://anonhg.NetBSD.org/src/rev/1f574f276494
branches:  trunk
changeset: 376287:1f574f276494
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Jun 09 08:16:06 2023 +0000

description:
indent: eliminate unused variable

No functional change.

diffstat:

 usr.bin/indent/indent.c |  16 ++++++----------
 1 files changed, 6 insertions(+), 10 deletions(-)

diffs (54 lines):

diff -r 6dfbedf630de -r 1f574f276494 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Fri Jun 09 08:10:58 2023 +0000
+++ b/usr.bin/indent/indent.c   Fri Jun 09 08:16:06 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.343 2023/06/09 08:10:58 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.344 2023/06/09 08:16:06 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: indent.c,v 1.343 2023/06/09 08:10:58 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.344 2023/06/09 08:16:06 rillig Exp $");
 
 #include <sys/param.h>
 #include <err.h>
@@ -92,7 +92,6 @@ FILE *input;
 FILE *output;
 
 static const char *in_name = "Standard Input";
-static const char *out_name = "Standard Output";
 static const char *backup_suffix = ".BAK";
 static char bakfile[MAXPATHLEN] = "";
 
@@ -259,12 +258,11 @@ parse_command_line(int argc, char **argv
                                err(1, "%s", in_name);
 
                } else if (output == NULL) {
-                       out_name = arg;
-                       if (strcmp(in_name, out_name) == 0)
+                       if (strcmp(arg, in_name) == 0)
                                errx(1, "input and output files "
                                    "must be different");
-                       if ((output = fopen(out_name, "w")) == NULL)
-                               err(1, "%s", out_name);
+                       if ((output = fopen(arg, "w")) == NULL)
+                               err(1, "%s", arg);
 
                } else
                        errx(1, "too many arguments: %s", arg);
@@ -273,10 +271,8 @@ parse_command_line(int argc, char **argv
        if (input == NULL) {
                input = stdin;
                output = stdout;
-       } else if (output == NULL) {
-               out_name = in_name;
+       } else if (output == NULL)
                bakcopy();
-       }
 
        if (opt.comment_column <= 1)
                opt.comment_column = 2; /* don't put normal comments in column



Home | Main Index | Thread Index | Old Index