Module Name:    src
Committed By:   rillig
Date:           Thu Jul 13 08:18:17 UTC 2023

Modified Files:
        src/usr.bin/xlint/lint1: lex.c

Log Message:
lint: clean up reading lint comments


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/usr.bin/xlint/lint1/lex.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/xlint/lint1/lex.c
diff -u src/usr.bin/xlint/lint1/lex.c:1.180 src/usr.bin/xlint/lint1/lex.c:1.181
--- src/usr.bin/xlint/lint1/lex.c:1.180	Thu Jul 13 07:19:24 2023
+++ src/usr.bin/xlint/lint1/lex.c	Thu Jul 13 08:18:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.180 2023/07/13 07:19:24 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.181 2023/07/13 08:18:17 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: lex.c,v 1.180 2023/07/13 07:19:24 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.181 2023/07/13 08:18:17 rillig Exp $");
 #endif
 
 #include <ctype.h>
@@ -1086,7 +1086,6 @@ lex_comment(void)
 
 	bool seen_end_of_comment = false;
 
-	/* Skip whitespace after the start of the comment */
 	while (c = read_byte(), isspace(c))
 		continue;
 
@@ -1104,14 +1103,12 @@ lex_comment(void)
 	keywd[l] = '\0';
 
 	/* look for the keyword */
-	for (i = 0; i < sizeof(keywtab) / sizeof(keywtab[0]); i++) {
+	for (i = 0; i < sizeof(keywtab) / sizeof(keywtab[0]); i++)
 		if (strcmp(keywtab[i].name, keywd) == 0)
-			break;
-	}
-	if (i == sizeof(keywtab) / sizeof(keywtab[0]))
-		goto skip_rest;
+			goto found_keyword;
+	goto skip_rest;
 
-	/* skip whitespace after the keyword */
+found_keyword:
 	while (isspace(c))
 		c = read_byte();
 
@@ -1126,7 +1123,6 @@ lex_comment(void)
 	arg[l] = '\0';
 	a = l != 0 ? atoi(arg) : -1;
 
-	/* skip whitespace after the argument */
 	while (isspace(c))
 		c = read_byte();
 

Reply via email to