Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/make make(1): migrate remaining code from Lst_Open t...
details: https://anonhg.NetBSD.org/src/rev/8b250d354d83
branches: trunk
changeset: 975337:8b250d354d83
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Aug 27 06:28:44 2020 +0000
description:
make(1): migrate remaining code from Lst_Open to Lst_OpenS
diffstat:
usr.bin/make/dir.c | 41 ++++++++++++++++++++++-------------------
usr.bin/make/lst.c | 18 +++---------------
usr.bin/make/lst.h | 3 +--
3 files changed, 26 insertions(+), 36 deletions(-)
diffs (169 lines):
diff -r f99c20f1cb8b -r 8b250d354d83 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c Thu Aug 27 06:18:22 2020 +0000
+++ b/usr.bin/make/dir.c Thu Aug 27 06:28:44 2020 +0000
@@ -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
diff -r f99c20f1cb8b -r 8b250d354d83 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c Thu Aug 27 06:18:22 2020 +0000
+++ b/usr.bin/make/lst.c Thu Aug 27 06:28:44 2020 +0000
@@ -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
@@ -637,18 +637,6 @@
/* 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. */
void
Lst_OpenS(Lst list)
{
diff -r f99c20f1cb8b -r 8b250d354d83 usr.bin/make/lst.h
--- a/usr.bin/make/lst.h Thu Aug 27 06:18:22 2020 +0000
+++ b/usr.bin/make/lst.h Thu Aug 27 06:28:44 2020 +0000
@@ -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);
Home |
Main Index |
Thread Index |
Old Index