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: reduce negations in main_loop



details:   https://anonhg.NetBSD.org/src/rev/65663b4af875
branches:  trunk
changeset: 1024052:65663b4af875
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Oct 08 20:28:56 2021 +0000

description:
indent: reduce negations in main_loop

No functional change.

diffstat:

 usr.bin/indent/indent.c |  16 +++++-----------
 1 files changed, 5 insertions(+), 11 deletions(-)

diffs (39 lines):

diff -r c7010faaf6e5 -r 65663b4af875 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Fri Oct 08 20:24:06 2021 +0000
+++ b/usr.bin/indent/indent.c   Fri Oct 08 20:28:56 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.129 2021/10/08 20:14:52 rillig Exp $      */
+/*     $NetBSD: indent.c,v 1.130 2021/10/08 20:28:56 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.129 2021/10/08 20:14:52 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.130 2021/10/08 20:28:56 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -1298,17 +1298,11 @@
            /* NOTREACHED */
        }
 
-       if (
-               ttype != comment &&
-               ttype != newline &&
-               ttype != preprocessing &&
-               ttype != form_feed) {
+       if (ttype == newline || ttype == form_feed || ttype == preprocessing)
+           force_nl = false;
+       else if (ttype != comment)
            process_comment_in_code(ttype, &force_nl);
 
-       } else if (ttype != comment)    /* preserve force_nl through a comment */
-           force_nl = false;   /* cancel forced newline after newline, form
-                                * feed, etc */
-
        buf_reserve(&code, 3);  /* space for 2 characters plus '\0' */
 
        switch (ttype) {



Home | Main Index | Thread Index | Old Index