Module Name: src Committed By: rillig Date: Fri Oct 8 20:28:56 UTC 2021
Modified Files: src/usr.bin/indent: indent.c Log Message: indent: reduce negations in main_loop No functional change. To generate a diff of this commit: cvs rdiff -u -r1.129 -r1.130 src/usr.bin/indent/indent.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.129 src/usr.bin/indent/indent.c:1.130 --- src/usr.bin/indent/indent.c:1.129 Fri Oct 8 20:14:52 2021 +++ src/usr.bin/indent/indent.c Fri Oct 8 20:28:56 2021 @@ -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 @@ static char sccsid[] = "@(#)indent.c 5.1 #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 @@ main_loop(void) /* 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) {