Module Name: src
Committed By: rillig
Date: Sun Oct 25 21:34:52 UTC 2020
Modified Files:
src/usr.bin/make: job.c
Log Message:
make(1): refactor JobDeleteTarget
Splitting the many conditions into separate pieces makes the code more
understandable.
To generate a diff of this commit:
cvs rdiff -u -r1.285 -r1.286 src/usr.bin/make/job.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/job.c
diff -u src/usr.bin/make/job.c:1.285 src/usr.bin/make/job.c:1.286
--- src/usr.bin/make/job.c:1.285 Sun Oct 25 20:34:05 2020
+++ src/usr.bin/make/job.c Sun Oct 25 21:34:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.285 2020/10/25 20:34:05 rillig Exp $ */
+/* $NetBSD: job.c,v 1.286 2020/10/25 21:34:52 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -143,7 +143,7 @@
#include "trace.h"
/* "@(#)job.c 8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.285 2020/10/25 20:34:05 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.286 2020/10/25 21:34:52 rillig Exp $");
/* A shell defines how the commands are run. All commands for a target are
* written into a single file, which is then given to the shell to execute
@@ -443,12 +443,20 @@ job_table_dump(const char *where)
static void
JobDeleteTarget(GNode *gn)
{
- if ((gn->type & (OP_JOIN|OP_PHONY)) == 0 && !Targ_Precious(gn)) {
- char *file = (gn->path == NULL ? gn->name : gn->path);
- if (!noExecute && eunlink(file) != -1) {
- Error("*** %s removed", file);
- }
- }
+ if (gn->type & OP_JOIN)
+ return;
+ if (gn->type & OP_PHONY)
+ return;
+ if (Targ_Precious(gn))
+ return;
+ if (noExecute)
+ return;
+
+ {
+ char *file = (gn->path == NULL ? gn->name : gn->path);
+ if (eunlink(file) != -1)
+ Error("*** %s removed", file);
+ }
}
/*