Module Name:    src
Committed By:   rillig
Date:           Thu Nov 25 17:50:01 UTC 2021

Modified Files:
        src/usr.bin/indent: lexi.c

Log Message:
indent: eliminate 3 negations in tokenizer

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/usr.bin/indent/lexi.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/lexi.c
diff -u src/usr.bin/indent/lexi.c:1.161 src/usr.bin/indent/lexi.c:1.162
--- src/usr.bin/indent/lexi.c:1.161	Thu Nov 25 17:46:51 2021
+++ src/usr.bin/indent/lexi.c	Thu Nov 25 17:50:00 2021
@@ -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 @@ static char sccsid[] = "@(#)lexi.c	8.1 (
 
 #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 @@ lexi(void)
 	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:

Reply via email to