make(1): rename defIncPath to defSysIncPath

There are two variables, parseIncPath and sysIncPath, which made the
name defIncPath ambiguous.
This commit is contained in:
rillig 2020-10-28 03:21:25 +00:00
parent 7dd3730386
commit 8742f4e00b
3 changed files with 21 additions and 19 deletions

View File

@ -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);

View File

@ -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 start of this whole
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 */

View File

@ -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 isSystem, Boolean depinc, int silent)
/*
* 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);