@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.111 2020/08/26 22:55:46 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.112 2020/08/27 06:28:44 rillig 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.111 2020/08/26 22:55:46 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.112 2020/08/27 06:28:44 rillig 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.111 2020/08/26 22:55:46 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.112 2020/08/27 06:28:44 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -795,13 +795,12 @@
{
LstNode ln; /* Current node */
- if (Lst_Open(path) == SUCCESS) {
- while ((ln = Lst_NextS(path)) != NULL) {
- Path *p = Lst_DatumS(ln);
- DirMatchFiles(word, p, expansions);
- }
- Lst_CloseS(path);
+ Lst_OpenS(path);
+ while ((ln = Lst_NextS(path)) != NULL) {
+ Path *p = Lst_DatumS(ln);
+ DirMatchFiles(word, p, expansions);
}
+ Lst_CloseS(path);
}
/* Print a word in the list of expansions.
@@ -840,6 +839,9 @@
{
const char *cp;
+ assert(path != NULL);
+ assert(expansions != NULL);
+
DIR_DEBUG1("Expanding \"%s\"... ", word);
cp = strchr(word, '{');
@@ -1128,12 +1130,13 @@
DIR_DEBUG1("Searching for %s ...", name);
- if (Lst_Open(path) == FAILURE) {
+ if (path == NULL) {
DIR_DEBUG0("couldn't open path, file not found\n");
misses += 1;
return NULL;
}
+ Lst_OpenS(path);
if ((ln = Lst_First(path)) != NULL) {
p = Lst_DatumS(ln);
if (p == dotLast) {
@@ -1660,7 +1663,8 @@
Buf_Init(&buf, 0);
- if (Lst_Open(path) == SUCCESS) {
+ if (path != NULL) {
+ Lst_OpenS(path);
while ((ln = Lst_NextS(path)) != NULL) {
Path *p = Lst_DatumS(ln);
Buf_AddStr(&buf, " ");
@@ -1780,7 +1784,6 @@
Dir_PrintDirectories(void)
{
LstNode ln;
- Path *p;
fprintf(debug_file, "#*** Directory Cache:\n");
fprintf(debug_file,
@@ -1788,14 +1791,14 @@
hits, misses, nearmisses, bigmisses,
percentage(hits, hits + bigmisses + nearmisses));
fprintf(debug_file, "# %-20s referenced\thits\n", "directory");
- if (Lst_Open(openDirectories) == SUCCESS) {
- while ((ln = Lst_NextS(openDirectories)) != NULL) {
- p = Lst_DatumS(ln);
- fprintf(debug_file, "# %-20s %10d\t%4d\n", p->name, p->refCount,
- p->hits);
- }
- Lst_CloseS(openDirectories);
+
+ Lst_OpenS(openDirectories);
+ while ((ln = Lst_NextS(openDirectories)) != NULL) {
+ Path *p = Lst_DatumS(ln);
+ fprintf(debug_file, "# %-20s %10d\t%4d\n", p->name, p->refCount,
+ p->hits);
}
+ Lst_CloseS(openDirectories);
}
static int
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.42 2020/08/26 22:55:46 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.43 2020/08/27 06:28:44 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -37,11 +37,11 @@
#include "make.h"
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.42 2020/08/26 22:55:46 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.43 2020/08/27 06:28:44 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.42 2020/08/26 22:55:46 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.43 2020/08/27 06:28:44 rillig Exp $");
#endif /* not lint */
#endif
@@ -634,18 +634,6 @@
* CurPtr points to their idea of the current node in the list and they
* access the list based on it.
*/
-
-/* Open a list for sequential access. A list can still be searched, etc.,
- * without confusing these functions. */
-ReturnStatus
-Lst_Open(Lst list)
-{
- if (!LstIsValid(list)) {
- return FAILURE;
- }
- Lst_OpenS(list);
- return SUCCESS;
-}
/* Open a list for sequential access. A list can still be searched, etc.,
* without confusing these functions. */
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.h,v 1.45 2020/08/26 23:00:47 rillig Exp $ */
+/* $NetBSD: lst.h,v 1.46 2020/08/27 06:28:44 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -171,7 +171,6 @@
* between Lst_Open() and Lst_Close().
*/
/* Open the list */
-ReturnStatus Lst_Open(Lst);
void Lst_OpenS(Lst);
/* Next element please, or NULL */
LstNode Lst_NextS(Lst);