Module Name: src
Committed By: rillig
Date: Sat Jan 1 21:04:15 UTC 2022
Modified Files:
src/usr.bin/make: parse.c
Log Message:
make: convert do-while into while in FindKeyword
GCC generates more efficient code; previously it wasn't aware that (end
- start) was always positive, thus allowing to omit the code for
dividing a negative number by 2.
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.610 -r1.611 src/usr.bin/make/parse.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/make/parse.c
diff -u src/usr.bin/make/parse.c:1.610 src/usr.bin/make/parse.c:1.611
--- src/usr.bin/make/parse.c:1.610 Sat Jan 1 19:44:05 2022
+++ src/usr.bin/make/parse.c Sat Jan 1 21:04:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.610 2022/01/01 19:44:05 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.611 2022/01/01 21:04:15 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
#include "pathnames.h"
/* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: parse.c,v 1.610 2022/01/01 19:44:05 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.611 2022/01/01 21:04:15 rillig Exp $");
/* types and constants */
@@ -539,7 +539,7 @@ FindKeyword(const char *str)
int start = 0;
int end = sizeof parseKeywords / sizeof parseKeywords[0] - 1;
- do {
+ while (start <= end) {
int curr = start + (end - start) / 2;
int diff = strcmp(str, parseKeywords[curr].name);
@@ -549,7 +549,7 @@ FindKeyword(const char *str)
end = curr - 1;
else
start = curr + 1;
- } while (start <= end);
+ }
return -1;
}