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 blankline_requested variables



details:   https://anonhg.NetBSD.org/src/rev/3d08d1bdac19
branches:  trunk
changeset: 989917:3d08d1bdac19
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Oct 20 05:14:21 2021 +0000

description:
indent: rename blankline_requested variables

The words 'prefix' and 'postfix' sounded too much like horizontal
concepts, like in operators. The actual purpose of these variables is to
add blank lines before and after the current line, so use the same
wording as in the command line options.

No functional change.

diffstat:

 tests/usr.bin/indent/opt_bacc.c |   4 ++--
 usr.bin/indent/indent.c         |  26 +++++++++++++-------------
 usr.bin/indent/indent.h         |   6 +++---
 usr.bin/indent/io.c             |  16 ++++++++--------
 usr.bin/indent/pr_comment.c     |   6 +++---
 5 files changed, 29 insertions(+), 29 deletions(-)

diffs (215 lines):

diff -r 2e39e5bcf9e9 -r 3d08d1bdac19 tests/usr.bin/indent/opt_bacc.c
--- a/tests/usr.bin/indent/opt_bacc.c   Wed Oct 20 05:07:08 2021 +0000
+++ b/tests/usr.bin/indent/opt_bacc.c   Wed Oct 20 05:14:21 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: opt_bacc.c,v 1.3 2021/10/18 07:11:31 rillig Exp $ */
+/* $NetBSD: opt_bacc.c,v 1.4 2021/10/20 05:14:21 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -23,7 +23,7 @@
 
 /*
  * XXX: As of 2021-10-05, the option -bacc has no effect on declarations since
- * process_decl resets prefix_blankline_requested unconditionally.
+ * process_decl resets blank_line_before unconditionally.
  */
 #indent run -bacc
 int            a;
diff -r 2e39e5bcf9e9 -r 3d08d1bdac19 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Wed Oct 20 05:07:08 2021 +0000
+++ b/usr.bin/indent/indent.c   Wed Oct 20 05:14:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.141 2021/10/20 05:07:08 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.142 2021/10/20 05:14:21 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.141 2021/10/20 05:07:08 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.142 2021/10/20 05:14:21 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -103,8 +103,8 @@
 
 bool found_err;
 int blank_lines_to_output;
-bool prefix_blankline_requested;
-bool postfix_blankline_requested;
+bool blank_line_before;
+bool blank_line_after;
 bool break_comma;
 float case_ind;
 bool had_eof;
@@ -939,7 +939,7 @@
     }
 
     if (ps.in_parameter_declaration)
-       prefix_blankline_requested = false;
+       blank_line_before = false;
 
     if (ps.p_l_follow > 0) {   /* check for preceding unbalanced parens */
        diag(1, "Unbalanced parens");
@@ -965,7 +965,7 @@
                                         * declaration, so don't do special
                                         * indentation of comments */
        if (opt.blanklines_after_decl_at_top && ps.in_parameter_declaration)
-           postfix_blankline_requested = true;
+           blank_line_after = true;
        ps.in_parameter_declaration = false;
        ps.in_decl = false;
     }
@@ -1013,14 +1013,14 @@
        ps.in_decl = true;
     }
 
-    prefix_blankline_requested = false;
+    blank_line_before = false;
     parse(rbrace);             /* let parser know about this */
     ps.search_brace = opt.cuddle_else
        && ps.p_stack[ps.tos] == if_expr_stmt
        && ps.il[ps.tos] >= ps.ind_level;
 
     if (ps.tos <= 1 && opt.blanklines_after_procs && ps.decl_nest <= 0)
-       postfix_blankline_requested = true;
+       blank_line_after = true;
 }
 
 static void
@@ -1080,7 +1080,7 @@
     if (ps.decl_nest <= 0)
        ps.just_saw_decl = 2;
 
-    prefix_blankline_requested = false;
+    blank_line_before = false;
 
     int len = (int)buf_len(&token) + 1;
     int ind = ps.ind_level == 0 || ps.decl_nest > 0
@@ -1298,11 +1298,11 @@
     }
 
     if (opt.blanklines_around_conditional_compilation) {
-       postfix_blankline_requested = true;
+       blank_line_after = true;
        blank_lines_to_output = 0;
     } else {
-       postfix_blankline_requested = false;
-       prefix_blankline_requested = false;
+       blank_line_after = false;
+       blank_line_before = false;
     }
 
     /*
@@ -1444,7 +1444,7 @@
 
        case type_def:
        case storage_class:
-           prefix_blankline_requested = false;
+           blank_line_before = false;
            goto copy_token;
 
        case keyword_struct_union_enum:
diff -r 2e39e5bcf9e9 -r 3d08d1bdac19 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Wed Oct 20 05:07:08 2021 +0000
+++ b/usr.bin/indent/indent.h   Wed Oct 20 05:14:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.h,v 1.39 2021/10/20 05:00:37 rillig Exp $       */
+/*     $NetBSD: indent.h,v 1.40 2021/10/20 05:14:21 rillig Exp $       */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -237,8 +237,8 @@
 
 extern bool found_err;
 extern int blank_lines_to_output;
-extern bool prefix_blankline_requested;
-extern bool postfix_blankline_requested;
+extern bool blank_line_before;
+extern bool blank_line_after;
 extern bool break_comma;       /* when true and not in parens, break after a
                                 * comma */
 extern float case_ind;         /* indentation level to be used for a "case
diff -r 2e39e5bcf9e9 -r 3d08d1bdac19 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Wed Oct 20 05:07:08 2021 +0000
+++ b/usr.bin/indent/io.c       Wed Oct 20 05:14:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.98 2021/10/20 05:00:37 rillig Exp $   */
+/*     $NetBSD: io.c,v 1.99 2021/10/20 05:14:21 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.98 2021/10/20 05:00:37 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.99 2021/10/20 05:14:21 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -225,7 +225,7 @@
 
     } else if (!inhibit_formatting) {
        suppress_blanklines = false;
-       if (prefix_blankline_requested && !first_line) {
+       if (blank_line_before && !first_line) {
            if (opt.swallow_optional_blanklines) {
                if (blank_lines_to_output == 1)
                    blank_lines_to_output = 0;
@@ -261,11 +261,11 @@
        ps.stats.lines++;
 
        if (ps.just_saw_decl == 1 && opt.blanklines_after_decl) {
-           prefix_blankline_requested = true;
+           blank_line_before = true;
            ps.just_saw_decl = 0;
        } else
-           prefix_blankline_requested = postfix_blankline_requested;
-       postfix_blankline_requested = false;
+           blank_line_before = blank_line_after;
+       blank_line_after = false;
     }
 
     ps.decl_on_line = ps.in_decl;      /* for proper comment indentation */
@@ -388,8 +388,8 @@
     inhibit_formatting = !on;
     if (on) {
        blank_lines_to_output = 0;
-       postfix_blankline_requested = false;
-       prefix_blankline_requested = false;
+       blank_line_after = false;
+       blank_line_before = false;
        suppress_blanklines = true;
     }
 }
diff -r 2e39e5bcf9e9 -r 3d08d1bdac19 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Wed Oct 20 05:07:08 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Wed Oct 20 05:14:21 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.79 2021/10/14 20:23:43 rillig Exp $   */
+/*     $NetBSD: pr_comment.c,v 1.80 2021/10/20 05:14:21 rillig Exp $   */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.79 2021/10/14 20:23:43 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.80 2021/10/20 05:14:21 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -213,7 +213,7 @@
        com.e = com.s + 2;
        *com.e = '\0';
        if (opt.blanklines_before_block_comments && ps.last_token != lbrace)
-           prefix_blankline_requested = true;
+           blank_line_before = true;
        dump_line();
        com.e = com.s = t;
        com_add_delim();



Home | Main Index | Thread Index | Old Index