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): use Lst_OpenS in Dir_SetPATH
details: https://anonhg.NetBSD.org/src/rev/5078c689b129
branches: trunk
changeset: 937635:5078c689b129
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 22 19:57:43 2020 +0000
description:
make(1): use Lst_OpenS in Dir_SetPATH
Since dirSearchPath is initialized in Dir_Init, opening the list can
never fail.
diffstat:
usr.bin/make/dir.c | 63 ++++++++++++++++++++++++++---------------------------
1 files changed, 31 insertions(+), 32 deletions(-)
diffs (98 lines):
diff -r 264de6ddcd43 -r 5078c689b129 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c Sat Aug 22 19:53:22 2020 +0000
+++ b/usr.bin/make/dir.c Sat Aug 22 19:57:43 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.106 2020/08/22 17:34:25 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.107 2020/08/22 19:57:43 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.106 2020/08/22 17:34:25 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.107 2020/08/22 19:57:43 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.106 2020/08/22 17:34:25 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.107 2020/08/22 19:57:43 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -478,43 +478,42 @@
{
LstNode ln; /* a list element */
Path *p;
- Boolean hasLastDot = FALSE; /* true we should search dot last */
+ Boolean hasLastDot = FALSE; /* true if we should search dot last */
Var_Delete(".PATH", VAR_GLOBAL);
- if (Lst_Open(dirSearchPath) == SUCCESS) {
- if ((ln = Lst_First(dirSearchPath)) != NULL) {
- p = Lst_DatumS(ln);
- if (p == dotLast) {
- hasLastDot = TRUE;
- Var_Append(".PATH", dotLast->name, VAR_GLOBAL);
- }
+ Lst_OpenS(dirSearchPath);
+ if ((ln = Lst_First(dirSearchPath)) != NULL) {
+ p = Lst_DatumS(ln);
+ if (p == dotLast) {
+ hasLastDot = TRUE;
+ Var_Append(".PATH", dotLast->name, VAR_GLOBAL);
}
+ }
- if (!hasLastDot) {
- if (dot)
- Var_Append(".PATH", dot->name, VAR_GLOBAL);
- if (cur)
- Var_Append(".PATH", cur->name, VAR_GLOBAL);
- }
+ if (!hasLastDot) {
+ if (dot)
+ Var_Append(".PATH", dot->name, VAR_GLOBAL);
+ if (cur)
+ Var_Append(".PATH", cur->name, VAR_GLOBAL);
+ }
- while ((ln = Lst_NextS(dirSearchPath)) != NULL) {
- p = Lst_DatumS(ln);
- if (p == dotLast)
- continue;
- if (p == dot && hasLastDot)
- continue;
- Var_Append(".PATH", p->name, VAR_GLOBAL);
- }
+ while ((ln = Lst_NextS(dirSearchPath)) != NULL) {
+ p = Lst_DatumS(ln);
+ if (p == dotLast)
+ continue;
+ if (p == dot && hasLastDot)
+ continue;
+ Var_Append(".PATH", p->name, VAR_GLOBAL);
+ }
- if (hasLastDot) {
- if (dot)
- Var_Append(".PATH", dot->name, VAR_GLOBAL);
- if (cur)
- Var_Append(".PATH", cur->name, VAR_GLOBAL);
- }
- Lst_CloseS(dirSearchPath);
+ if (hasLastDot) {
+ if (dot)
+ Var_Append(".PATH", dot->name, VAR_GLOBAL);
+ if (cur)
+ Var_Append(".PATH", cur->name, VAR_GLOBAL);
}
+ Lst_CloseS(dirSearchPath);
}
/*-
Home |
Main Index |
Thread Index |
Old Index