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 dump functions to output



details:   https://anonhg.NetBSD.org/src/rev/92f203d5420c
branches:  trunk
changeset: 1026516:92f203d5420c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 27 18:37:17 2021 +0000

description:
indent: rename dump functions to output

No functional change.

diffstat:

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

diffs (truncated from 370 to 300 lines):

diff -r b274ae1ee092 -r 92f203d5420c tests/usr.bin/indent/token_comment.c
--- a/tests/usr.bin/indent/token_comment.c      Sat Nov 27 18:29:29 2021 +0000
+++ b/tests/usr.bin/indent/token_comment.c      Sat Nov 27 18:37:17 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: token_comment.c,v 1.26 2021/11/25 20:44:10 rillig Exp $ */
+/* $NetBSD: token_comment.c,v 1.27 2021/11/27 18:37:17 rillig Exp $ */
 /* $FreeBSD$ */
 
 /*
@@ -895,7 +895,7 @@
 /*
  * A completely empty line in a box comment must be copied unmodified to the
  * output. This is done in process_comment by adding a space to the end of an
- * otherwise empty comment. This space forces dump_line to add some output,
+ * otherwise empty comment. This space forces output_complete_line to add some output,
  * but the trailing space is discarded, resulting in an empty line.
  */
 #indent input
diff -r b274ae1ee092 -r 92f203d5420c usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sat Nov 27 18:29:29 2021 +0000
+++ b/usr.bin/indent/indent.c   Sat Nov 27 18:37:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.235 2021/11/27 18:29:29 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.236 2021/11/27 18:37:17 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.235 2021/11/27 18:29:29 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.236 2021/11/27 18:37:17 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -596,7 +596,7 @@
 process_eof(void)
 {
     if (lab.s != lab.e || code.s != code.e || com.s != com.e)
-       dump_line();
+       output_line();
 
     if (ps.tos > 1)            /* check for balanced braces */
        diag(1, "Stuff missing from end of file");
@@ -624,7 +624,7 @@
 
     if (opt.verbose)
        diag(0, "Line broken");
-    dump_line();
+    output_line();
     ps.want_blank = false;
     *force_nl = false;
 }
@@ -643,7 +643,7 @@
 static void
 process_form_feed(void)
 {
-    dump_line_ff();
+    output_line_ff();
     ps.want_blank = false;
 }
 
@@ -655,7 +655,7 @@
        com.s == com.e)
        goto stay_in_line;
 
-    dump_line();
+    output_line();
     ps.want_blank = false;
 
 stay_in_line:
@@ -911,13 +911,13 @@
 
     if (code.s != code.e && !ps.block_init) {
        if (!opt.brace_same_line) {
-           dump_line();
+           output_line();
            ps.want_blank = false;
        } else if (ps.in_func_def_params && !ps.init_or_struct) {
            ps.ind_level_follow = 0;
            if (opt.function_brace_split) {     /* dump the line prior to the
                                                 * brace ... */
-               dump_line();
+               output_line();
                ps.want_blank = false;
            } else              /* add a space between the decl and brace */
                ps.want_blank = true;
@@ -985,7 +985,7 @@
     if (code.s != code.e && !ps.block_init) {  /* '}' must be first on line */
        if (opt.verbose)
            diag(0, "Line broken");
-       dump_line();
+       output_line();
     }
 
     *code.e++ = '}';
@@ -1021,7 +1021,7 @@
     if (code.e != code.s) {    /* make sure this starts a line */
        if (opt.verbose)
            diag(0, "Line broken");
-       dump_line();
+       output_line();
        ps.want_blank = false;
     }
 
@@ -1038,7 +1038,7 @@
     if (code.e > code.s && !(opt.cuddle_else && code.e[-1] == '}')) {
        if (opt.verbose)
            diag(0, "Line broken");
-       dump_line();            /* make sure this starts a line */
+       output_line();          /* make sure this starts a line */
        ps.want_blank = false;
     }
 
@@ -1054,7 +1054,7 @@
 
     if (ps.prev_token == lsym_rparen_or_rbracket && ps.tos <= 1) {
        if (code.s != code.e) {
-           dump_line();
+           output_line();
            ps.want_blank = false;
        }
     }
@@ -1089,7 +1089,7 @@
            ps.in_decl = false;
            if (opt.procnames_start_line && code.s != code.e) {
                *code.e = '\0';
-               dump_line();
+               output_line();
            } else if (ps.want_blank) {
                *code.e++ = ' ';
            }
@@ -1234,7 +1234,7 @@
 process_preprocessing(void)
 {
     if (com.s != com.e || lab.s != lab.e || code.s != code.e)
-       dump_line();
+       output_line();
 
     read_preprocessing_line();
 
diff -r b274ae1ee092 -r 92f203d5420c usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Sat Nov 27 18:29:29 2021 +0000
+++ b/usr.bin/indent/indent.h   Sat Nov 27 18:37:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.h,v 1.103 2021/11/26 15:18:18 rillig Exp $      */
+/*     $NetBSD: indent.h,v 1.104 2021/11/27 18:37:17 rillig Exp $      */
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -391,8 +391,8 @@
 
 lexer_symbol lexi(void);
 void diag(int, const char *, ...)__printflike(2, 3);
-void dump_line(void);
-void dump_line_ff(void);
+void output_line(void);
+void output_line_ff(void);
 void inp_read_line(void);
 void parse(parser_symbol);
 void parse_stmt_head(stmt_head);
diff -r b274ae1ee092 -r 92f203d5420c usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Sat Nov 27 18:29:29 2021 +0000
+++ b/usr.bin/indent/io.c       Sat Nov 27 18:37:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: io.c,v 1.140 2021/11/27 18:26:48 rillig Exp $  */
+/*     $NetBSD: io.c,v 1.141 2021/11/27 18:37:17 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.140 2021/11/27 18:26:48 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.141 2021/11/27 18:37:17 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -397,7 +397,7 @@
 }
 
 static int
-dump_line_label(void)
+output_line_label(void)
 {
     int ind;
 
@@ -414,7 +414,7 @@
 }
 
 static int
-dump_line_code(int ind)
+output_line_code(int ind)
 {
 
     int target_ind = compute_code_indent();
@@ -434,7 +434,7 @@
 }
 
 static void
-dump_line_comment(int ind)
+output_line_comment(int ind)
 {
     int target_ind = ps.com_ind;
     const char *p = com.s;
@@ -478,7 +478,7 @@
  * the label, the code and the comment.
  */
 static void
-output_line(char line_terminator)
+output_complete_line(char line_terminator)
 {
     static bool first_line = true;
 
@@ -513,11 +513,11 @@
 
        int ind = 0;
        if (lab.e != lab.s)
-           ind = dump_line_label();
+           ind = output_line_label();
        if (code.e != code.s)
-           ind = dump_line_code(ind);
+           ind = output_line_code(ind);
        if (com.e != com.s)
-           dump_line_comment(ind);
+           output_line_comment(ind);
 
        output_char(line_terminator);
        ps.stats.lines++;
@@ -551,15 +551,15 @@
 }
 
 void
-dump_line(void)
+output_line(void)
 {
-    output_line('\n');
+    output_complete_line('\n');
 }
 
 void
-dump_line_ff(void)
+output_line_ff(void)
 {
-    output_line('\f');
+    output_complete_line('\f');
 }
 
 static int
@@ -658,7 +658,7 @@
        return;
 
     if (com.s != com.e || lab.s != lab.e || code.s != code.e)
-       dump_line();
+       output_line();
 
     inhibit_formatting = !on;
     if (on) {
diff -r b274ae1ee092 -r 92f203d5420c usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Sat Nov 27 18:29:29 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Sat Nov 27 18:37:17 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pr_comment.c,v 1.125 2021/11/26 15:18:18 rillig Exp $  */
+/*     $NetBSD: pr_comment.c,v 1.126 2021/11/27 18:37:17 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.125 2021/11/26 15:18:18 rillig Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.126 2021/11/27 18:37:17 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -153,7 +153,7 @@
     if (!may_wrap) {
        /*
         * Find out how much indentation there was originally, because that
-        * much will have to be ignored by dump_line().
+        * much will have to be ignored by output_complete_line.
         */
        const char *start = inp_line_start();
        ps.n_comment_delta = -ind_add(0, start, inp_p() - 2);
@@ -178,7 +178,7 @@
        if (opt.blanklines_before_block_comments &&
                ps.prev_token != lsym_lbrace)
            blank_line_before = true;
-       dump_line();
+       output_line();
        com_add_delim();
     }
 
@@ -201,7 +201,7 @@
     for (;;) {
        switch (inp_peek()) {
        case '\f':



Home | Main Index | Thread Index | Old Index