Module Name:    src
Committed By:   rillig
Date:           Sat Nov 27 21:15:58 UTC 2021

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

Log Message:
indent: accept a few formatting suggestions from indent

The remaining issues are still that the conditions look ambiguous even
with -eei, and that __attribute__ is broken into a separate line.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.104 -r1.105 src/usr.bin/indent/indent.h
cvs rdiff -u -r1.141 -r1.142 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.236 src/usr.bin/indent/indent.c:1.237
--- src/usr.bin/indent/indent.c:1.236	Sat Nov 27 18:37:17 2021
+++ src/usr.bin/indent/indent.c	Sat Nov 27 21:15:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.236 2021/11/27 18:37:17 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.237 2021/11/27 21:15:58 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.236 2021/11/27 18:37:17 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.237 2021/11/27 21:15:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -899,7 +899,7 @@ static void
 process_lbrace(bool *force_nl, bool *spaced_expr, stmt_head hd,
     int *di_stack, int di_stack_cap, int *decl_ind)
 {
-    ps.in_stmt_or_decl = false;		/* don't indent the {} */
+    ps.in_stmt_or_decl = false;	/* don't indent the {} */
 
     if (!ps.block_init)
 	*force_nl = true;	/* force other stuff on same line as '{' onto
@@ -993,7 +993,7 @@ process_rbrace(bool *spaced_expr, int *d
     ps.in_stmt_or_decl = false;
     ps.in_stmt_cont = false;
 
-    if (ps.decl_level > 0) { /* we are in multi-level structure declaration */
+    if (ps.decl_level > 0) {	/* multi-level structure declaration */
 	*decl_ind = di_stack[--ps.decl_level];
 	if (ps.decl_level == 0 && !ps.in_func_def_params) {
 	    ps.just_saw_decl = 2;

Index: src/usr.bin/indent/indent.h
diff -u src/usr.bin/indent/indent.h:1.104 src/usr.bin/indent/indent.h:1.105
--- src/usr.bin/indent/indent.h:1.104	Sat Nov 27 18:37:17 2021
+++ src/usr.bin/indent/indent.h	Sat Nov 27 21:15:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.h,v 1.104 2021/11/27 18:37:17 rillig Exp $	*/
+/*	$NetBSD: indent.h,v 1.105 2021/11/27 21:15:58 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -148,8 +148,8 @@ extern FILE *input;
 extern FILE *output;
 
 extern struct buffer token;	/* the current token to be processed, is
-				 * typically copied to the buffer 'code',
-				 * or in some cases to 'lab'. */
+				 * typically copied to the buffer 'code', or
+				 * in some cases to 'lab'. */
 
 extern struct buffer lab;	/* the label or preprocessor directive */
 extern struct buffer code;	/* the main part of the current line of code */

Index: src/usr.bin/indent/io.c
diff -u src/usr.bin/indent/io.c:1.141 src/usr.bin/indent/io.c:1.142
--- src/usr.bin/indent/io.c:1.141	Sat Nov 27 18:37:17 2021
+++ src/usr.bin/indent/io.c	Sat Nov 27 21:15:58 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: io.c,v 1.141 2021/11/27 18:37:17 rillig Exp $	*/
+/*	$NetBSD: io.c,v 1.142 2021/11/27 21:15:58 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.141 2021/11/27 18:37:17 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.142 2021/11/27 21:15:58 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
 #endif
@@ -93,8 +93,8 @@ const char *
 inp_line_start(void)
 {
     /*
-     * The comment we're about to read usually comes from inp.buf, unless
-     * it has been copied into save_com.
+     * The comment we're about to read usually comes from inp.buf, unless it
+     * has been copied into save_com.
      */
     return inbuf.saved_inp_s != NULL ? inbuf.save_com_buf : inbuf.inp.buf;
 }
@@ -167,7 +167,7 @@ inp_comment_check_size(size_t n)
 	return;
 
     diag(1, "Internal buffer overflow - "
-	    "Move big comment from right after if, while, or whatever");
+	"Move big comment from right after if, while, or whatever");
     fflush(output);
     exit(1);
 }
@@ -192,9 +192,8 @@ inp_comment_init_comment(void)
 	return;
 
     /*
-     * Copy everything from the start of the line, because
-     * process_comment() will use that to calculate the original
-     * indentation of a boxed comment.
+     * Copy everything from the start of the line, because process_comment()
+     * will use that to calculate the original indentation of a boxed comment.
      */
     /*
      * TODO: Don't store anything in the memory range [input.inp.buf,
@@ -202,8 +201,8 @@ inp_comment_init_comment(void)
      */
     /*
      * FIXME: The '4' below is completely wrong. For example, in the snippet
-     * 'if(expr)/''*comment', the 'r)' of the code is not copied. If there
-     * is an additional line break before the ')', memcpy tries to copy
+     * 'if(expr)/''*comment', the 'r)' of the code is not copied. If there is
+     * an additional line break before the ')', memcpy tries to copy
      * (size_t)-1 bytes.
      *
      * The original author of this magic number doesn't remember its purpose

Reply via email to