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: rename next_blank_lines to blank_line...



details:   https://anonhg.NetBSD.org/src/rev/ae2bca77274a
branches:  trunk
changeset: 989915:ae2bca77274a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Oct 20 05:00:37 2021 +0000

description:
indent: rename next_blank_lines to blank_lines_to_output

The previous name was already an improvement over the name before that
(n_real_blanklines), but didn't express the intended purpose clearly
enough, so try another name.

No functional change.

diffstat:

 usr.bin/indent/indent.c |   8 ++++----
 usr.bin/indent/indent.h |   4 ++--
 usr.bin/indent/io.c     |  18 +++++++++---------
 3 files changed, 15 insertions(+), 15 deletions(-)

diffs (109 lines):

diff -r 21ded3d84d4a -r ae2bca77274a usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Wed Oct 20 03:26:20 2021 +0000
+++ b/usr.bin/indent/indent.c   Wed Oct 20 05:00:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.139 2021/10/19 18:29:59 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.140 2021/10/20 05:00:37 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.139 2021/10/19 18:29:59 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.140 2021/10/20 05:00:37 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -102,7 +102,7 @@
 char *saved_inp_e;
 
 bool found_err;
-int next_blank_lines;
+int blank_lines_to_output;
 bool prefix_blankline_requested;
 bool postfix_blankline_requested;
 bool break_comma;
@@ -1295,7 +1295,7 @@
 
     if (opt.blanklines_around_conditional_compilation) {
        postfix_blankline_requested = true;
-       next_blank_lines = 0;
+       blank_lines_to_output = 0;
     } else {
        postfix_blankline_requested = false;
        prefix_blankline_requested = false;
diff -r 21ded3d84d4a -r ae2bca77274a usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Wed Oct 20 03:26:20 2021 +0000
+++ b/usr.bin/indent/indent.h   Wed Oct 20 05:00:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.h,v 1.38 2021/10/09 11:00:27 rillig Exp $       */
+/*     $NetBSD: indent.h,v 1.39 2021/10/20 05:00:37 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -236,7 +236,7 @@
 
 
 extern bool found_err;
-extern int next_blank_lines;
+extern int blank_lines_to_output;
 extern bool prefix_blankline_requested;
 extern bool postfix_blankline_requested;
 extern bool break_comma;       /* when true and not in parens, break after a
diff -r 21ded3d84d4a -r ae2bca77274a usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Wed Oct 20 03:26:20 2021 +0000
+++ b/usr.bin/indent/io.c       Wed Oct 20 05:00:37 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.97 2021/10/19 21:39:19 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.98 2021/10/20 05:00:37 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.97 2021/10/19 21:39:19 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.98 2021/10/20 05:00:37 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -221,21 +221,21 @@
        if (suppress_blanklines)
            suppress_blanklines = false;
        else
-           next_blank_lines++;
+           blank_lines_to_output++;
 
     } else if (!inhibit_formatting) {
        suppress_blanklines = false;
        if (prefix_blankline_requested && !first_line) {
            if (opt.swallow_optional_blanklines) {
-               if (next_blank_lines == 1)
-                   next_blank_lines = 0;
+               if (blank_lines_to_output == 1)
+                   blank_lines_to_output = 0;
            } else {
-               if (next_blank_lines == 0)
-                   next_blank_lines = 1;
+               if (blank_lines_to_output == 0)
+                   blank_lines_to_output = 1;
            }
        }
 
-       for (; next_blank_lines > 0; next_blank_lines--)
+       for (; blank_lines_to_output > 0; blank_lines_to_output--)
            output_char('\n');
 
        if (ps.ind_level == 0)
@@ -387,7 +387,7 @@
 
     inhibit_formatting = !on;
     if (on) {
-       next_blank_lines = 0;
+       blank_lines_to_output = 0;
        postfix_blankline_requested = false;
        prefix_blankline_requested = false;
        suppress_blanklines = true;



Home | Main Index | Thread Index | Old Index