Module Name:    src
Committed By:   rillig
Date:           Wed Oct 28 03:21:25 UTC 2020

Modified Files:
        src/usr.bin/make: main.c make.h parse.c

Log Message:
make(1): rename defIncPath to defSysIncPath

There are two variables, parseIncPath and sysIncPath, which made the
name defIncPath ambiguous.


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/usr.bin/make/main.c src/usr.bin/make/parse.c
cvs rdiff -u -r1.174 -r1.175 src/usr.bin/make/make.h

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/main.c
diff -u src/usr.bin/make/main.c:1.408 src/usr.bin/make/main.c:1.409
--- src/usr.bin/make/main.c:1.408	Tue Oct 27 19:16:46 2020
+++ src/usr.bin/make/main.c	Wed Oct 28 03:21:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.408 2020/10/27 19:16:46 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.409 2020/10/28 03:21:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.408 2020/10/27 19:16:46 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.409 2020/10/28 03:21:25 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1141,7 +1141,7 @@ InitVarMake(const char *argv0)
 }
 
 static void
-InitDefIncPath(char *syspath)
+InitDefSysIncPath(char *syspath)
 {
 	static char defsyspath[] = _PATH_DEFSYSPATH;
 	char *start, *cp;
@@ -1165,11 +1165,11 @@ InitDefIncPath(char *syspath)
 		}
 		/* look for magic parent directory search string */
 		if (strncmp(".../", start, 4) != 0) {
-			(void)Dir_AddDir(defIncPath, start);
+			(void)Dir_AddDir(defSysIncPath, start);
 		} else {
 			char *dir = Dir_FindHereOrAbove(curdir, start + 4);
 			if (dir != NULL) {
-				(void)Dir_AddDir(defIncPath, dir);
+				(void)Dir_AddDir(defSysIncPath, dir);
 				free(dir);
 			}
 		}
@@ -1184,7 +1184,7 @@ ReadBuiltinRules(void)
 {
 	StringList *sysMkPath = Lst_New();
 	Dir_Expand(_PATH_DEFSYSMK,
-		   Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath,
+		   Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath,
 		   sysMkPath);
 	if (Lst_IsEmpty(sysMkPath))
 		Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK);
@@ -1515,7 +1515,7 @@ main(int argc, char **argv)
 
 	InitVarTargets();
 
-	InitDefIncPath(syspath);
+	InitDefSysIncPath(syspath);
 
 	/*
 	 * Read in the built-in rules first, followed by the specified
@@ -1634,9 +1634,11 @@ ReadMakefile(const char *fname)
 		}
 		/* look in -I and system include directories. */
 		name = Dir_FindFile(fname, parseIncPath);
-		if (!name)
-			name = Dir_FindFile(fname,
-				Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath);
+		if (!name) {
+			SearchPath *sysInc = Lst_IsEmpty(sysIncPath)
+					     ? defSysIncPath : sysIncPath;
+			name = Dir_FindFile(fname, sysInc);
+		}
 		if (!name || (fd = open(name, O_RDONLY)) == -1) {
 			free(name);
 			free(path);
Index: src/usr.bin/make/parse.c
diff -u src/usr.bin/make/parse.c:1.408 src/usr.bin/make/parse.c:1.409
--- src/usr.bin/make/parse.c:1.408	Wed Oct 28 03:12:54 2020
+++ src/usr.bin/make/parse.c	Wed Oct 28 03:21:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.408 2020/10/28 03:12:54 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.409 2020/10/28 03:21:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -117,7 +117,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.408 2020/10/28 03:12:54 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.409 2020/10/28 03:21:25 rillig Exp $");
 
 /* types and constants */
 
@@ -280,10 +280,10 @@ CurFile(void)
     return GetInclude(includes.len - 1);
 }
 
-/* include paths (lists of directories) */
+/* include paths */
 SearchPath *parseIncPath;	/* dirs for "..." includes */
 SearchPath *sysIncPath;		/* dirs for <...> includes */
-SearchPath *defIncPath;		/* default for sysIncPath */
+SearchPath *defSysIncPath;		/* default for sysIncPath */
 
 /* parser tables */
 
@@ -2206,7 +2206,7 @@ Parse_include_file(char *file, Boolean i
 	/*
 	 * Look for it on the system path
 	 */
-	SearchPath *path = Lst_IsEmpty(sysIncPath) ? defIncPath : sysIncPath;
+	SearchPath *path = Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath;
 	fullname = Dir_FindFile(file, path);
     }
 
@@ -3144,7 +3144,7 @@ Parse_Init(void)
     mainNode = NULL;
     parseIncPath = Lst_New();
     sysIncPath = Lst_New();
-    defIncPath = Lst_New();
+    defSysIncPath = Lst_New();
     Vector_Init(&includes, sizeof(IFile));
 #ifdef CLEANUP
     targCmds = Lst_New();
@@ -3158,7 +3158,7 @@ Parse_End(void)
 #ifdef CLEANUP
     Lst_Destroy(targCmds, free);
     assert(targets == NULL);
-    Lst_Destroy(defIncPath, Dir_Destroy);
+    Lst_Destroy(defSysIncPath, Dir_Destroy);
     Lst_Destroy(sysIncPath, Dir_Destroy);
     Lst_Destroy(parseIncPath, Dir_Destroy);
     assert(includes.len == 0);

Index: src/usr.bin/make/make.h
diff -u src/usr.bin/make/make.h:1.174 src/usr.bin/make/make.h:1.175
--- src/usr.bin/make/make.h:1.174	Tue Oct 27 07:03:55 2020
+++ src/usr.bin/make/make.h	Wed Oct 28 03:21:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: make.h,v 1.174 2020/10/27 07:03:55 rillig Exp $	*/
+/*	$NetBSD: make.h,v 1.175 2020/10/28 03:21:25 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -447,7 +447,7 @@ extern time_t	now;		/* The time at the s
 extern Boolean	oldVars;	/* Do old-style variable substitution */
 
 extern SearchPath *sysIncPath;	/* The system include path. */
-extern SearchPath *defIncPath;	/* The default include path. */
+extern SearchPath *defSysIncPath; /* The default system include path. */
 
 extern char	curdir[];	/* Startup directory */
 extern char	*progname;	/* The program name */

Reply via email to