commit 5c534ffbf14e8366dd6d94e75b48efc2b36ecf60
parent 018ca72d4dd84a58604adb1dd69882e3673edcdd
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Fri, 10 Jan 2025 21:19:12 +0100
make: Add fast return in addtarget()
It does not make sense to test for things that we do know are false.
Diffstat:
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/cmd/scc-make/rules.c b/src/cmd/scc-make/rules.c
@@ -91,25 +91,33 @@ addtarget(char *target, int ndeps)
Target *tp = lookup(target);
tp->defined = 1;
- if (!deftarget && target[0] != '.')
+ if (!deftarget && target[0] != '.') {
deftarget = tp;
+ return;
+ }
if (strcmp(target, ".SUFFIXES") == 0 && ndeps == 0) {
free(tp->deps);
tp->deps = NULL;
tp->ndeps = 0;
+ return;
}
if (strcmp(target, ".DEFAULT") == 0) {
if (ndeps > 0)
error("DEFAULT rule with prerequisites");
+ return;
}
- if (strcmp(target, ".SILENT") == 0 && ndeps == 0)
+ if (strcmp(target, ".SILENT") == 0 && ndeps == 0) {
sflag = 1;
+ return;
+ }
- if (strcmp(target, ".IGNORE") == 0 && ndeps == 0)
+ if (strcmp(target, ".IGNORE") == 0 && ndeps == 0) {
iflag = 1;
+ return;
+ }
}
void