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: eliminate 3 negations in tokenizer



details:   https://anonhg.NetBSD.org/src/rev/18076a638d1b
branches:  trunk
changeset: 1026461:18076a638d1b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Nov 25 17:50:00 2021 +0000

description:
indent: eliminate 3 negations in tokenizer

No functional change.

diffstat:

 usr.bin/indent/lexi.c |  17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diffs (43 lines):

diff -r 9fc33f864139 -r 18076a638d1b usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Thu Nov 25 17:46:51 2021 +0000
+++ b/usr.bin/indent/lexi.c     Thu Nov 25 17:50:00 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lexi.c,v 1.161 2021/11/25 17:46:51 rillig Exp $        */
+/*     $NetBSD: lexi.c,v 1.162 2021/11/25 17:50:00 rillig Exp $        */
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.161 2021/11/25 17:46:51 rillig Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.162 2021/11/25 17:50:00 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
 #endif
@@ -694,18 +694,17 @@
        break;
 
     case '*':
-       if (!ps.next_unary && !ps.in_parameter_declaration &&
-               !(ps.in_decl && ps.p_l_follow > 0)) {
+       if (ps.next_unary || ps.in_parameter_declaration ||
+               (ps.in_decl && ps.p_l_follow > 0)) {
+           lex_asterisk_unary();
+           lsym = lsym_unary_op;
+           next_unary = true;
+       } else {
            if (inp_peek() == '=')
                *token.e++ = inp_next();
            lsym = lsym_binary_op;
            next_unary = true;
-           break;
        }
-
-       lex_asterisk_unary();
-       lsym = lsym_unary_op;
-       next_unary = true;
        break;
 
     default:



Home | Main Index | Thread Index | Old Index