Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make Partially initialize Dir before MainParseArgs c...
details: https://anonhg.NetBSD.org/src/rev/47474ac66ed1
branches: trunk
changeset: 351024:47474ac66ed1
user: sjg <sjg%NetBSD.org@localhost>
date: Tue Jan 31 06:54:23 2017 +0000
description:
Partially initialize Dir before MainParseArgs can be called.
The rest can be done once curdir is finalized.
diffstat:
usr.bin/make/dir.c | 18 ++++++++++--------
usr.bin/make/main.c | 11 +++++++----
2 files changed, 17 insertions(+), 12 deletions(-)
diffs (91 lines):
diff -r 7db67f7576b6 -r 47474ac66ed1 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c Tue Jan 31 03:44:14 2017 +0000
+++ b/usr.bin/make/dir.c Tue Jan 31 06:54:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $ */
+/* $NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)dir.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: dir.c,v 1.68 2016/06/07 00:40:00 sjg Exp $");
+__RCSID("$NetBSD: dir.c,v 1.69 2017/01/31 06:54:23 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -346,11 +346,13 @@
void
Dir_Init(const char *cdname)
{
- dirSearchPath = Lst_Init(FALSE);
- openDirectories = Lst_Init(FALSE);
- Hash_InitTable(&mtimes, 0);
- Hash_InitTable(&lmtimes, 0);
-
+ if (!cdname) {
+ dirSearchPath = Lst_Init(FALSE);
+ openDirectories = Lst_Init(FALSE);
+ Hash_InitTable(&mtimes, 0);
+ Hash_InitTable(&lmtimes, 0);
+ return;
+ }
Dir_InitCur(cdname);
dotLast = bmake_malloc(sizeof(Path));
diff -r 7db67f7576b6 -r 47474ac66ed1 usr.bin/make/main.c
--- a/usr.bin/make/main.c Tue Jan 31 03:44:14 2017 +0000
+++ b/usr.bin/make/main.c Tue Jan 31 06:54:23 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $ */
+/* $NetBSD: main.c,v 1.255 2017/01/31 06:54:23 sjg Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.255 2017/01/31 06:54:23 sjg Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.254 2016/12/10 23:12:39 christos Exp $");
+__RCSID("$NetBSD: main.c,v 1.255 2017/01/31 06:54:23 sjg Exp $");
#endif
#endif /* not lint */
#endif
@@ -1038,6 +1038,8 @@
#ifdef USE_META
meta_init();
#endif
+ Dir_Init(NULL); /* Dir_* safe to call from MainParseArgs */
+
/*
* First snag any flags out of the MAKE environment variable.
* (Note this is *not* MAKEFLAGS since /bin/make uses that and it's
@@ -1279,7 +1281,8 @@
fprintf(debug_file, "job_pipe %d %d, maxjobs %d, tokens %d, compat %d\n",
jp_0, jp_1, maxJobs, maxJobTokens, compatMake);
- Main_ExportMAKEFLAGS(TRUE); /* initial export */
+ if (!printVars)
+ Main_ExportMAKEFLAGS(TRUE); /* initial export */
/*
Home |
Main Index |
Thread Index |
Old Index