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 Lst_AtFront to Lst_PrependS
details: https://anonhg.NetBSD.org/src/rev/9d0b527e2992
branches: trunk
changeset: 975182:9d0b527e2992
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 22 23:06:51 2020 +0000
description:
make(1): migrate Lst_AtFront to Lst_PrependS
This makes Lst_AtFront unused, as well as LstInsertBefore.
diffstat:
usr.bin/make/dir.c | 11 +++++++----
usr.bin/make/lst.c | 54 +++---------------------------------------------------
2 files changed, 10 insertions(+), 55 deletions(-)
diffs (124 lines):
diff -r a3e55220b4ad -r 9d0b527e2992 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c Sat Aug 22 22:57:53 2020 +0000
+++ b/usr.bin/make/dir.c Sat Aug 22 23:06:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dir.c,v 1.108 2020/08/22 22:57:53 rillig Exp $ */
+/* $NetBSD: dir.c,v 1.109 2020/08/22 23:06:51 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.108 2020/08/22 22:57:53 rillig Exp $";
+static char rcsid[] = "$NetBSD: dir.c,v 1.109 2020/08/22 23:06:51 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.108 2020/08/22 22:57:53 rillig Exp $");
+__RCSID("$NetBSD: dir.c,v 1.109 2020/08/22 23:06:51 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -1564,8 +1564,11 @@
if (ln != NULL)
return Lst_DatumS(ln);
else {
+ /* XXX: It is wrong to increment the refCount if dotLast is not
+ * used afterwards. */
dotLast->refCount += 1;
- (void)Lst_AtFront(path, dotLast);
+ if (path != NULL)
+ Lst_PrependS(path, dotLast);
}
}
diff -r a3e55220b4ad -r 9d0b527e2992 usr.bin/make/lst.c
--- a/usr.bin/make/lst.c Sat Aug 22 22:57:53 2020 +0000
+++ b/usr.bin/make/lst.c Sat Aug 22 23:06:51 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.35 2020/08/22 22:57:53 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.36 2020/08/22 23:06:51 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.35 2020/08/22 22:57:53 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.36 2020/08/22 23:06:51 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.35 2020/08/22 22:57:53 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.36 2020/08/22 23:06:51 rillig Exp $");
#endif /* not lint */
#endif
@@ -179,46 +179,6 @@
/* Insert a new node with the given piece of data before the given node in the
* given list. */
-static ReturnStatus
-LstInsertBefore(Lst list, LstNode node, void *datum)
-{
- LstNode newNode;
-
- /*
- * check validity of arguments
- */
- if (LstIsValid(list) && (LstIsEmpty(list) && node == NULL))
- goto ok;
-
- if (!LstIsValid(list) || LstIsEmpty(list) || !LstNodeIsValid(node)) {
- return FAILURE;
- }
-
- ok:
- newNode = LstNodeNew(datum);
-
- if (node == NULL) {
- newNode->prev = newNode->next = NULL;
- list->first = list->last = newNode;
- } else {
- newNode->prev = node->prev;
- newNode->next = node;
-
- if (newNode->prev != NULL) {
- newNode->prev->next = newNode;
- }
- node->prev = newNode;
-
- if (node == list->first) {
- list->first = newNode;
- }
- }
-
- return SUCCESS;
-}
-
-/* Insert a new node with the given piece of data before the given node in the
- * given list. */
void
Lst_InsertBeforeS(Lst list, LstNode node, void *datum)
{
@@ -243,14 +203,6 @@
}
}
-/* Add a piece of data at the front of the given list. */
-ReturnStatus
-Lst_AtFront(Lst list, void *datum)
-{
- LstNode front = Lst_First(list);
- return LstInsertBefore(list, front, datum);
-}
-
/* Add a piece of data at the start of the given list. */
void
Lst_PrependS(Lst list, void *datum)
Home |
Main Index |
Thread Index |
Old Index