Module Name:    src
Committed By:   rillig
Date:           Wed Oct 20 05:00:37 UTC 2021

Modified Files:
        src/usr.bin/indent: indent.c indent.h io.c

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.97 -r1.98 src/usr.bin/indent/io.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.139 src/usr.bin/indent/indent.c:1.140
--- src/usr.bin/indent/indent.c:1.139	Tue Oct 19 18:29:59 2021
+++ src/usr.bin/indent/indent.c	Wed Oct 20 05:00:37 2021
@@ -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 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #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_s;
 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 @@ process_preprocessing(void)
 
     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;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.38 src/usr.bin/indent/indent.h:1.39
--- src/usr.bin/indent/indent.h:1.38	Sat Oct  9 11:00:27 2021
+++ src/usr.bin/indent/indent.h	Wed Oct 20 05:00:37 2021
@@ -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 @@ enum keyword_kind {
 
 
 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

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.97 src/usr.bin/indent/io.c:1.98
--- src/usr.bin/indent/io.c:1.97	Tue Oct 19 21:39:19 2021
+++ src/usr.bin/indent/io.c	Wed Oct 20 05:00:37 2021
@@ -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 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #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 @@ dump_line(void)
 	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 @@ parse_indent_comment(void)
 
     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;

Reply via email to