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: accept a few formatting suggestions f...



details:   https://anonhg.NetBSD.org/src/rev/0e3aedd7979d
branches:  trunk
changeset: 1026525:0e3aedd7979d
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 27 21:15:58 2021 +0000

description:
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.

diffstat:

 usr.bin/indent/indent.c |   8 ++++----
 usr.bin/indent/indent.h |   6 +++---
 usr.bin/indent/io.c     |  19 +++++++++----------
 3 files changed, 16 insertions(+), 17 deletions(-)

diffs (117 lines):

diff -r 447acfcb91e9 -r 0e3aedd7979d usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Sat Nov 27 21:15:53 2021 +0000
+++ b/usr.bin/indent/indent.c   Sat Nov 27 21:15:58 2021 +0000
@@ -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 @@
 
 #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 @@
 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 @@
     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;
diff -r 447acfcb91e9 -r 0e3aedd7979d usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h   Sat Nov 27 21:15:53 2021 +0000
+++ b/usr.bin/indent/indent.h   Sat Nov 27 21:15:58 2021 +0000
@@ -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 *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 */
diff -r 447acfcb91e9 -r 0e3aedd7979d usr.bin/indent/io.c
--- a/usr.bin/indent/io.c       Sat Nov 27 21:15:53 2021 +0000
+++ b/usr.bin/indent/io.c       Sat Nov 27 21:15:58 2021 +0000
@@ -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 @@
 
 #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 @@
 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 @@
        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 @@
        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 @@
      */
     /*
      * 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



Home | Main Index | Thread Index | Old Index