Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): reduce scope of cp in meta_oodate
details: https://anonhg.NetBSD.org/src/rev/2c37e7784983
branches: trunk
changeset: 958041:2c37e7784983
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Dec 20 22:12:36 2020 +0000
description:
make(1): reduce scope of cp in meta_oodate
That function is way too long (550 lines) and has too creative variable
names such as fname, fname1, fname2, fname3.
diffstat:
usr.bin/make/meta.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diffs (57 lines):
diff -r 17651d2f45ad -r 2c37e7784983 usr.bin/make/meta.c
--- a/usr.bin/make/meta.c Sun Dec 20 22:02:54 2020 +0000
+++ b/usr.bin/make/meta.c Sun Dec 20 22:12:36 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meta.c,v 1.162 2020/12/20 22:02:54 rillig Exp $ */
+/* $NetBSD: meta.c,v 1.163 2020/12/20 22:12:36 rillig Exp $ */
/*
* Implement 'meta' mode.
@@ -1076,7 +1076,6 @@
FStr dname;
const char *tname;
char *p;
- char *cp;
char *link_src;
char *move_target;
static size_t cwdlen = 0;
@@ -1296,13 +1295,15 @@
* the src as for 'R'ead
* and the target as for 'W'rite.
*/
- cp = p; /* save this for a second */
- /* now get target */
- if (strsep(&p, " ") == NULL)
- continue;
- CHECK_VALID_META(p);
- move_target = p;
- p = cp;
+ {
+ char *cp = p; /* save this for a second */
+ /* now get target */
+ if (strsep(&p, " ") == NULL)
+ continue;
+ CHECK_VALID_META(p);
+ move_target = p;
+ p = cp;
+ }
/* 'L' and 'M' put single quotes around the args */
DEQUOTE(p);
DEQUOTE(move_target);
@@ -1487,6 +1488,7 @@
fname, lineno);
oodate = TRUE;
} else {
+ const char *cp;
char *cmd = cmdNode->datum;
Boolean hasOODATE = FALSE;
@@ -1573,7 +1575,7 @@
}
} else {
if (writeMeta && (metaMissing || (gn->type & OP_META))) {
- cp = NULL;
+ const char *cp = NULL;
/* if target is in .CURDIR we do not need a meta file */
if (gn->path && (cp = strrchr(gn->path, '/')) && cp > gn->path) {
Home |
Main Index |
Thread Index |
Old Index