Module Name:    src
Committed By:   rillig
Date:           Sun Jan 15 00:05:38 UTC 2023

Modified Files:
        src/usr.bin/xlint/lint1: cgram.y

Log Message:
lint: make read_until_parent easier to understand

Previously, the '--level' in the loop condition looked as if it applied
more often than it really does.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.425 -r1.426 src/usr.bin/xlint/lint1/cgram.y

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.425 src/usr.bin/xlint/lint1/cgram.y:1.426
--- src/usr.bin/xlint/lint1/cgram.y:1.425	Sat Jan 14 10:33:34 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Sun Jan 15 00:05:38 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.425 2023/01/14 10:33:34 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.426 2023/01/15 00:05:38 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.425 2023/01/14 10:33:34 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.426 2023/01/15 00:05:38 rillig Exp $");
 #endif
 
 #include <limits.h>
@@ -2146,12 +2146,11 @@ read_until_rparen(void)
 	freeyyv(&yylval, yychar);
 
 	level = 1;
-	while (yychar != T_RPAREN || --level > 0) {
-		if (yychar == T_LPAREN) {
+	while (yychar > 0) {
+		if (yychar == T_LPAREN)
 			level++;
-		} else if (yychar <= 0) {
+		if (yychar == T_RPAREN && --level == 0)
 			break;
-		}
 		freeyyv(&yylval, yychar = yylex());
 	}
 

Reply via email to