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: untangle want_blank_before_lparen



details:   https://anonhg.NetBSD.org/src/rev/b00a5ca25deb
branches:  trunk
changeset: 987535:b00a5ca25deb
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Sep 30 21:38:43 2021 +0000

description:
indent: untangle want_blank_before_lparen

No functional change.

diffstat:

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

diffs (39 lines):

diff -r 77a7857ef1ec -r b00a5ca25deb usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Thu Sep 30 21:33:55 2021 +0000
+++ b/usr.bin/indent/indent.c   Thu Sep 30 21:38:43 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: indent.c,v 1.94 2021/09/30 21:33:55 rillig Exp $       */
+/*     $NetBSD: indent.c,v 1.95 2021/09/30 21:38:43 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.94 2021/09/30 21:33:55 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.95 2021/09/30 21:38:43 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -596,11 +596,15 @@
 static bool
 want_blank_before_lparen(void)
 {
-    return ps.want_blank &&
-          ((ps.last_token != ident && ps.last_token != funcname) ||
-           opt.proc_calls_space ||
-           (ps.keyword == kw_sizeof ? opt.blank_after_sizeof :
-            ps.keyword != kw_0 && ps.keyword != kw_offsetof));
+    if (!ps.want_blank)
+       return false;
+    if (ps.last_token != ident && ps.last_token != funcname)
+       return true;
+    if (opt.proc_calls_space)
+       return true;
+    if (ps.keyword == kw_sizeof)
+       return opt.blank_after_sizeof;
+    return ps.keyword != kw_0 && ps.keyword != kw_offsetof;
 }
 
 static void



Home | Main Index | Thread Index | Old Index