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: convert found_err to bool



details:   https://anonhg.NetBSD.org/src/rev/32e2f309414a
branches:  trunk
changeset: 1023771:32e2f309414a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 25 22:54:32 2021 +0000

description:
indent: convert found_err to bool

That variable had slipped through the migration since it consequently
used int for the declaration, the definition and all assignments.

No functional change.

diffstat:

 usr.bin/indent/indent.c       |  10 +++++-----
 usr.bin/indent/indent_globs.h |   4 ++--
 usr.bin/indent/io.c           |   6 +++---
 3 files changed, 10 insertions(+), 10 deletions(-)

diffs (90 lines):

diff -r 499de106a59a -r 32e2f309414a usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sat Sep 25 22:24:35 2021 +0000
+++ b/usr.bin/indent/indent.c   Sat Sep 25 22:54:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.82 2021/09/25 22:24:35 rillig Exp $       */
+/*     $NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.82 2021/09/25 22:24:35 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.83 2021/09/25 22:54:32 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -105,7 +105,7 @@
 char       *bp_save;
 char       *be_save;
 
-int         found_err;
+bool        found_err;
 int         n_real_blanklines;
 bool        prefix_blankline_requested;
 bool        postfix_blankline_requested;
@@ -376,7 +376,7 @@
 static void
 main_init_globals(void)
 {
-    found_err = 0;
+    found_err = false;
 
     ps.p_stack[0] = stmt;      /* this is the parser's stack */
     ps.last_nl = true;         /* this is true if the last thing scanned was
@@ -510,7 +510,7 @@
     }
 
     fflush(output);
-    exit(found_err);
+    exit(found_err ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
 static void
diff -r 499de106a59a -r 32e2f309414a usr.bin/indent/indent_globs.h
--- a/usr.bin/indent/indent_globs.h     Sat Sep 25 22:24:35 2021 +0000
+++ b/usr.bin/indent/indent_globs.h     Sat Sep 25 22:54:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent_globs.h,v 1.35 2021/09/25 20:56:53 rillig Exp $ */
+/*     $NetBSD: indent_globs.h,v 1.36 2021/09/25 22:54:32 rillig Exp $ */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -173,7 +173,7 @@
 };
 
 
-extern int         found_err;
+extern bool        found_err;
 extern int         n_real_blanklines;
 extern bool        prefix_blankline_requested;
 extern bool        postfix_blankline_requested;
diff -r 499de106a59a -r 32e2f309414a usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Sat Sep 25 22:24:35 2021 +0000
+++ b/usr.bin/indent/io.c       Sat Sep 25 22:54:32 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.64 2021/09/25 20:56:53 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.64 2021/09/25 20:56:53 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.65 2021/09/25 22:54:32 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -466,7 +466,7 @@
     const char *s, *e;
 
     if (level != 0)
-       found_err = 1;
+       found_err = true;
 
     if (output == stdout) {
        s = "/**INDENT** ";



Home | Main Index | Thread Index | Old Index