Module Name: src Committed By: rillig Date: Sat Jan 23 10:48:49 UTC 2021
Modified Files: src/usr.bin/make: arch.c dir.c dir.h main.c parse.c suff.c src/usr.bin/make/unit-tests: dir.mk Log Message: make(1): rename Dir_Expand to SearchPath_Expand The main subject of this function is the search path. In this search path the pattern is expanded. To generate a diff of this commit: cvs rdiff -u -r1.193 -r1.194 src/usr.bin/make/arch.c cvs rdiff -u -r1.255 -r1.256 src/usr.bin/make/dir.c cvs rdiff -u -r1.40 -r1.41 src/usr.bin/make/dir.h cvs rdiff -u -r1.514 -r1.515 src/usr.bin/make/main.c cvs rdiff -u -r1.527 -r1.528 src/usr.bin/make/parse.c cvs rdiff -u -r1.335 -r1.336 src/usr.bin/make/suff.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/dir.mk 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/arch.c diff -u src/usr.bin/make/arch.c:1.193 src/usr.bin/make/arch.c:1.194 --- src/usr.bin/make/arch.c:1.193 Sat Jan 9 16:06:09 2021 +++ src/usr.bin/make/arch.c Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.193 2021/01/09 16:06:09 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.194 2021/01/23 10:48:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -126,7 +126,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.193 2021/01/09 16:06:09 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.194 2021/01/23 10:48:49 rillig Exp $"); typedef struct List ArchList; typedef struct ListNode ArchListNode; @@ -341,7 +341,7 @@ Arch_ParseArchive(char **pp, GNodeList * } else if (Dir_HasWildcards(memName)) { StringList members = LST_INIT; - Dir_Expand(memName, &dirSearchPath, &members); + SearchPath_Expand(&dirSearchPath, memName, &members); while (!Lst_IsEmpty(&members)) { char *member = Lst_Dequeue(&members); Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.255 src/usr.bin/make/dir.c:1.256 --- src/usr.bin/make/dir.c:1.255 Sun Jan 10 21:20:46 2021 +++ src/usr.bin/make/dir.c Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.255 2021/01/10 21:20:46 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.256 2021/01/23 10:48:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -89,8 +89,9 @@ * Returns TRUE if the name given it needs to * be wildcard-expanded. * - * Dir_Expand Given a pattern and a path, return a Lst of names - * which match the pattern on the search path. + * SearchPath_Expand + * Expand a filename pattern to find all matching files + * from the search path. * * Dir_FindFile Searches for a file on a given search path. * If it exists, the entire path is returned. @@ -137,7 +138,7 @@ #include "job.h" /* "@(#)dir.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: dir.c,v 1.255 2021/01/10 21:20:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.256 2021/01/23 10:48:49 rillig Exp $"); /* * A search path is a list of CachedDir structures. A CachedDir has in it the @@ -797,7 +798,7 @@ DirExpandCurly(const char *word, const c suffix, suffix_len); if (contains_wildcard(file)) { - Dir_Expand(file, path, expansions); + SearchPath_Expand(path, file, expansions); free(file); } else { Lst_Append(expansions, file); @@ -843,7 +844,7 @@ PrintExpansions(StringList *expansions) * expansions the list on which to place the results */ void -Dir_Expand(const char *word, SearchPath *path, StringList *expansions) +SearchPath_Expand(SearchPath *path, const char *word, StringList *expansions) { const char *cp; Index: src/usr.bin/make/dir.h diff -u src/usr.bin/make/dir.h:1.40 src/usr.bin/make/dir.h:1.41 --- src/usr.bin/make/dir.h:1.40 Tue Dec 1 19:28:32 2020 +++ src/usr.bin/make/dir.h Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.40 2020/12/01 19:28:32 rillig Exp $ */ +/* $NetBSD: dir.h,v 1.41 2021/01/23 10:48:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -83,7 +83,7 @@ void Dir_InitDot(void); void Dir_End(void); void Dir_SetPATH(void); Boolean Dir_HasWildcards(const char *); -void Dir_Expand(const char *, SearchPath *, StringList *); +void SearchPath_Expand(SearchPath *, const char *, StringList *); char *Dir_FindFile(const char *, SearchPath *); char *Dir_FindHereOrAbove(const char *, const char *); void Dir_UpdateMTime(GNode *, Boolean); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.514 src/usr.bin/make/main.c:1.515 --- src/usr.bin/make/main.c:1.514 Tue Jan 19 20:51:46 2021 +++ src/usr.bin/make/main.c Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.514 2021/01/19 20:51:46 rillig Exp $ */ +/* $NetBSD: main.c,v 1.515 2021/01/23 10:48:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -110,7 +110,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.514 2021/01/19 20:51:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.515 2021/01/23 10:48:49 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1214,8 +1214,9 @@ ReadBuiltinRules(void) StringListNode *ln; StringList sysMkPath = LST_INIT; - Dir_Expand(_PATH_DEFSYSMK, + SearchPath_Expand( Lst_IsEmpty(sysIncPath) ? defSysIncPath : sysIncPath, + _PATH_DEFSYSMK, &sysMkPath); if (Lst_IsEmpty(&sysMkPath)) Fatal("%s: no system rules (%s).", progname, _PATH_DEFSYSMK); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.527 src/usr.bin/make/parse.c:1.528 --- src/usr.bin/make/parse.c:1.527 Thu Jan 21 14:30:01 2021 +++ src/usr.bin/make/parse.c Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.527 2021/01/21 14:30:01 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.528 2021/01/23 10:48:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.527 2021/01/21 14:30:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.528 2021/01/23 10:48:49 rillig Exp $"); /* types and constants */ @@ -1176,7 +1176,7 @@ ParseDoDependencyTargetMundane(char *lin */ SearchPath *emptyPath = SearchPath_New(); - Dir_Expand(line, emptyPath, curTargs); + SearchPath_Expand(emptyPath, line, curTargs); SearchPath_Free(emptyPath); } else { Index: src/usr.bin/make/suff.c diff -u src/usr.bin/make/suff.c:1.335 src/usr.bin/make/suff.c:1.336 --- src/usr.bin/make/suff.c:1.335 Sun Jan 10 21:20:46 2021 +++ src/usr.bin/make/suff.c Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: suff.c,v 1.335 2021/01/10 21:20:46 rillig Exp $ */ +/* $NetBSD: suff.c,v 1.336 2021/01/23 10:48:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -114,7 +114,7 @@ #include "dir.h" /* "@(#)suff.c 8.4 (Berkeley) 3/21/94" */ -MAKE_RCSID("$NetBSD: suff.c,v 1.335 2021/01/10 21:20:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: suff.c,v 1.336 2021/01/23 10:48:49 rillig Exp $"); typedef List SuffixList; typedef ListNode SuffixListNode; @@ -1246,7 +1246,7 @@ ExpandWildcards(GNodeListNode *cln, GNod * Expand the word along the chosen path */ Lst_Init(&expansions); - Dir_Expand(cgn->name, Suff_FindPath(cgn), &expansions); + SearchPath_Expand(Suff_FindPath(cgn), cgn->name, &expansions); while (!Lst_IsEmpty(&expansions)) { GNode *gn; Index: src/usr.bin/make/unit-tests/dir.mk diff -u src/usr.bin/make/unit-tests/dir.mk:1.8 src/usr.bin/make/unit-tests/dir.mk:1.9 --- src/usr.bin/make/unit-tests/dir.mk:1.8 Tue Nov 3 18:42:33 2020 +++ src/usr.bin/make/unit-tests/dir.mk Sat Jan 23 10:48:49 2021 @@ -1,4 +1,4 @@ -# $NetBSD: dir.mk,v 1.8 2020/11/03 18:42:33 rillig Exp $ +# $NetBSD: dir.mk,v 1.9 2021/01/23 10:48:49 rillig Exp $ # # Tests for dir.c. @@ -79,7 +79,7 @@ single-word: # Demonstrate debug logging for filename expansion, especially curly braces. .MAKEFLAGS: -dd -# The below line does not call Dir_Expand yet. +# The below line does not call SearchPath_Expand yet. # It is expanded only when necessary, that is, when the 'debug' target is # indeed made. debug: {{thi,fou}r,fif}twen