Module Name:    src
Committed By:   rillig
Date:           Sat Nov 27 18:37:17 UTC 2021

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

Log Message:
indent: rename dump functions to output

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/tests/usr.bin/indent/token_comment.c
cvs rdiff -u -r1.235 -r1.236 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.103 -r1.104 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.140 -r1.141 src/usr.bin/indent/io.c
cvs rdiff -u -r1.125 -r1.126 src/usr.bin/indent/pr_comment.c

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

Modified files:

Index: src/tests/usr.bin/indent/token_comment.c
diff -u src/tests/usr.bin/indent/token_comment.c:1.26 src/tests/usr.bin/indent/token_comment.c:1.27
--- src/tests/usr.bin/indent/token_comment.c:1.26	Thu Nov 25 20:44:10 2021
+++ src/tests/usr.bin/indent/token_comment.c	Sat Nov 27 18:37:17 2021
@@ -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 @@ int		decl;
 /*
  * 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

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.235 src/usr.bin/indent/indent.c:1.236
--- src/usr.bin/indent/indent.c:1.235	Sat Nov 27 18:29:29 2021
+++ src/usr.bin/indent/indent.c	Sat Nov 27 18:37:17 2021
@@ -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 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #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 @@ static void __attribute__((__noreturn__)
 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 @@ maybe_break_line(lexer_symbol lsym, bool
 
     if (opt.verbose)
 	diag(0, "Line broken");
-    dump_line();
+    output_line();
     ps.want_blank = false;
     *force_nl = false;
 }
@@ -643,7 +643,7 @@ move_com_to_code(void)
 static void
 process_form_feed(void)
 {
-    dump_line_ff();
+    output_line_ff();
     ps.want_blank = false;
 }
 
@@ -655,7 +655,7 @@ process_newline(void)
 	com.s == com.e)
 	goto stay_in_line;
 
-    dump_line();
+    output_line();
     ps.want_blank = false;
 
 stay_in_line:
@@ -911,13 +911,13 @@ process_lbrace(bool *force_nl, bool *spa
 
     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 @@ process_rbrace(bool *spaced_expr, int *d
     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 @@ process_do(bool *force_nl, bool *last_el
     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 @@ process_else(bool *force_nl, bool *last_
     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 @@ process_type(int *decl_ind, bool *tabs_t
 
     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 @@ process_ident(lexer_symbol lsym, int dec
 	    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 @@ static void
 process_preprocessing(void)
 {
     if (com.s != com.e || lab.s != lab.e || code.s != code.e)
-	dump_line();
+	output_line();
 
     read_preprocessing_line();
 

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.103 src/usr.bin/indent/indent.h:1.104
--- src/usr.bin/indent/indent.h:1.103	Fri Nov 26 15:18:18 2021
+++ src/usr.bin/indent/indent.h	Sat Nov 27 18:37:17 2021
@@ -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 @@ void debug_inp(const char *);
 
 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);

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.140 src/usr.bin/indent/io.c:1.141
--- src/usr.bin/indent/io.c:1.140	Sat Nov 27 18:26:48 2021
+++ src/usr.bin/indent/io.c	Sat Nov 27 18:37:17 2021
@@ -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 @@ static char sccsid[] = "@(#)io.c	8.1 (Be
 
 #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 @@ output_indent(int old_ind, int new_ind)
 }
 
 static int
-dump_line_label(void)
+output_line_label(void)
 {
     int ind;
 
@@ -414,7 +414,7 @@ dump_line_label(void)
 }
 
 static int
-dump_line_code(int ind)
+output_line_code(int ind)
 {
 
     int target_ind = compute_code_indent();
@@ -434,7 +434,7 @@ dump_line_code(int ind)
 }
 
 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 @@ dump_line_comment(int ind)
  * 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 @@ output_line(char line_terminator)
 
 	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 @@ output_line(char line_terminator)
 }
 
 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 @@ parse_indent_comment(void)
 	return;
 
     if (com.s != com.e || lab.s != lab.e || code.s != code.e)
-	dump_line();
+	output_line();
 
     inhibit_formatting = !on;
     if (on) {

Index: src/usr.bin/indent/pr_comment.c
diff -u src/usr.bin/indent/pr_comment.c:1.125 src/usr.bin/indent/pr_comment.c:1.126
--- src/usr.bin/indent/pr_comment.c:1.125	Fri Nov 26 15:18:18 2021
+++ src/usr.bin/indent/pr_comment.c	Sat Nov 27 18:37:17 2021
@@ -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 @@ static char sccsid[] = "@(#)pr_comment.c
 
 #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 @@ analyze_comment(bool *p_may_wrap, bool *
     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 @@ analyze_comment(bool *p_may_wrap, bool *
 	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 @@ copy_comment_wrap(int adj_max_line_lengt
     for (;;) {
 	switch (inp_peek()) {
 	case '\f':
-	    dump_line_ff();
+	    output_line_ff();
 	    last_blank = -1;
 	    com_add_delim();
 	    inp_skip();
@@ -212,7 +212,7 @@ copy_comment_wrap(int adj_max_line_lengt
 	case '\n':
 	    if (had_eof) {
 		diag(1, "Unterminated comment");
-		dump_line();
+		output_line();
 		return;
 	    }
 
@@ -221,10 +221,10 @@ copy_comment_wrap(int adj_max_line_lengt
 		if (com.s == com.e)
 		    com_add_char(' ');	/* force empty line of output */
 		if (com.e - com.s > 3) {
-		    dump_line();
+		    output_line();
 		    com_add_delim();
 		}
-		dump_line();
+		output_line();
 		com_add_delim();
 
 	    } else {
@@ -257,7 +257,7 @@ copy_comment_wrap(int adj_max_line_lengt
 
 		if (break_delim) {
 		    if (com.e - com.s > 3)
-			dump_line();
+			output_line();
 		    else
 			com.e = com.s;
 		    com_add_char(' ');
@@ -297,7 +297,7 @@ copy_comment_wrap(int adj_max_line_lengt
 		break;
 
 	    if (last_blank == -1) {	/* only a single word in this line */
-		dump_line();
+		output_line();
 		com_add_delim();
 		break;
 	    }
@@ -305,7 +305,7 @@ copy_comment_wrap(int adj_max_line_lengt
 	    const char *last_word_s = com.buf + last_blank + 1;
 	    size_t last_word_len = (size_t)(com.e - last_word_s);
 	    com.e = com.buf + last_blank;
-	    dump_line();
+	    output_line();
 	    com_add_delim();
 
 	    memcpy(com.e, last_word_s, last_word_len);
@@ -325,13 +325,13 @@ copy_comment_nowrap(void)
 
 	    if (had_eof) {
 		diag(1, "Unterminated comment");
-		dump_line();
+		output_line();
 		return;
 	    }
 
 	    if (com.s == com.e)
 		com_add_char(' ');	/* force output of an empty line */
-	    dump_line();
+	    output_line();
 	    ++line_no;
 	    inp_skip();
 	    continue;

Reply via email to