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: use bool for suppress_blanklines



details:   https://anonhg.NetBSD.org/src/rev/30cd4dd2d0c1
branches:  trunk
changeset: 989102:30cd4dd2d0c1
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Oct 11 19:04:47 2021 +0000

description:
indent: use bool for suppress_blanklines

It only ever got assigned the values 0 and 1.

No functional change.

diffstat:

 usr.bin/indent/io.c |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (53 lines):

diff -r 76333fa0159a -r 30cd4dd2d0c1 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Mon Oct 11 18:55:49 2021 +0000
+++ b/usr.bin/indent/io.c       Mon Oct 11 19:04:47 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.93 2021/10/11 18:55:49 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.94 2021/10/11 19:04:47 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.93 2021/10/11 18:55:49 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.94 2021/10/11 19:04:47 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -56,7 +56,7 @@
 #include "indent.h"
 
 static int paren_indent;
-static int suppress_blanklines;
+static bool suppress_blanklines;
 
 static void
 output_char(char ch)
@@ -218,13 +218,13 @@
     }
 
     if (code.s == code.e && lab.s == lab.e && com.s == com.e) {
-       if (suppress_blanklines > 0)
-           suppress_blanklines--;
+       if (suppress_blanklines)
+           suppress_blanklines = false;
        else
            next_blank_lines++;
 
     } else if (!inhibit_formatting) {
-       suppress_blanklines = 0;
+       suppress_blanklines = false;
        if (prefix_blankline_requested && !first_line) {
            if (opt.swallow_optional_blanklines) {
                if (next_blank_lines == 1)
@@ -391,7 +391,7 @@
        next_blank_lines = 0;
        postfix_blankline_requested = false;
        prefix_blankline_requested = false;
-       suppress_blanklines = 1;
+       suppress_blanklines = true;
     }
 }
 



Home | Main Index | Thread Index | Old Index