From 972d6db1ca14d90fc3676b343115398d30ba5e17 Mon Sep 17 00:00:00 2001 From: harti Date: Thu, 9 Dec 2004 15:31:32 +0000 Subject: [PATCH] Nobody actually checked the return codes from Lst_Append and Lst_Insert so don't return anything. --- usr.bin/make/lst.h | 4 ++-- usr.bin/make/lst.lib/lstAppend.c | 16 +--------------- usr.bin/make/lst.lib/lstDupl.c | 12 ++++-------- usr.bin/make/lst.lib/lstInsert.c | 20 ++------------------ 4 files changed, 9 insertions(+), 43 deletions(-) diff --git a/usr.bin/make/lst.h b/usr.bin/make/lst.h index e9c8f1ccb7ef..f78d52365080 100644 --- a/usr.bin/make/lst.h +++ b/usr.bin/make/lst.h @@ -112,9 +112,9 @@ void Lst_Destroy(Lst *, FreeProc *); * Functions to modify a list */ /* Insert an element before another */ -ReturnStatus Lst_Insert(Lst *, LstNode *, void *); +void Lst_Insert(Lst *, LstNode *, void *); /* Insert an element after another */ -ReturnStatus Lst_Append(Lst *, LstNode *, void *); +void Lst_Append(Lst *, LstNode *, void *); /* Place an element at the front of a lst. */ #define Lst_AtFront(LST, D) (Lst_Insert((LST), Lst_First(LST), (D))) /* Place an element at the end of a lst. */ diff --git a/usr.bin/make/lst.lib/lstAppend.c b/usr.bin/make/lst.lib/lstAppend.c index b5c201d1c69c..297926c3ca8e 100644 --- a/usr.bin/make/lst.lib/lstAppend.c +++ b/usr.bin/make/lst.lib/lstAppend.c @@ -54,9 +54,6 @@ __FBSDID("$FreeBSD$"); * Lst_Append -- * Create a new node and add it to the given list after the given node. * - * Results: - * SUCCESS if all went well. - * * Arguments: * l affected list * ln node after which to append the datum @@ -70,20 +67,11 @@ __FBSDID("$FreeBSD$"); * *----------------------------------------------------------------------- */ -ReturnStatus +void Lst_Append(Lst *list, LstNode *ln, void *d) { LstNode *nLNode; - if (Lst_Valid(list) && (ln == NULL && Lst_IsEmpty(list))) { - goto ok; - } - - if (!Lst_Valid(list) || Lst_IsEmpty(list) || ! Lst_NodeValid(ln, list)) { - return (FAILURE); - } - ok: - nLNode = emalloc(sizeof(*nLNode)); nLNode->datum = d; nLNode->useCount = nLNode->flags = 0; @@ -104,6 +92,4 @@ Lst_Append(Lst *list, LstNode *ln, void *d) list->lastPtr = nLNode; } } - - return (SUCCESS); } diff --git a/usr.bin/make/lst.lib/lstDupl.c b/usr.bin/make/lst.lib/lstDupl.c index 364c526d3e55..2596816a69d7 100644 --- a/usr.bin/make/lst.lib/lstDupl.c +++ b/usr.bin/make/lst.lib/lstDupl.c @@ -84,14 +84,10 @@ Lst_Duplicate(Lst *list, DuplicateProc *copyProc) ln = list->firstPtr; while (ln != NULL) { - if (copyProc != NOCOPY) { - if (Lst_AtEnd(nl, (*copyProc)(ln->datum)) == FAILURE) { - return (NULL); - } - } else if (Lst_AtEnd (nl, ln->datum) == FAILURE) { - return (NULL); - } - + if (copyProc != NOCOPY) + Lst_AtEnd(nl, (*copyProc)(ln->datum)); + else + Lst_AtEnd(nl, ln->datum); ln = ln->nextPtr; } diff --git a/usr.bin/make/lst.lib/lstInsert.c b/usr.bin/make/lst.lib/lstInsert.c index 61010ca9fe3b..5bb7a0de8cd2 100644 --- a/usr.bin/make/lst.lib/lstInsert.c +++ b/usr.bin/make/lst.lib/lstInsert.c @@ -55,9 +55,7 @@ __FBSDID("$FreeBSD$"); * Insert a new node with the given piece of data before the given * node in the given list. * - * Results: - * SUCCESS or FAILURE. - * + * Parameters: * l list to manipulate * ln node before which to insert d * d datum to be inserted @@ -68,24 +66,12 @@ __FBSDID("$FreeBSD$"); * *----------------------------------------------------------------------- */ -ReturnStatus +void Lst_Insert(Lst *list, LstNode *ln, void *d) { LstNode *nLNode; /* new lnode for d */ - /* - * check validity of arguments - */ - if (Lst_Valid(list) && (Lst_IsEmpty(list) && ln == NULL)) - goto ok; - - if (!Lst_Valid(list) || Lst_IsEmpty(list) || !Lst_NodeValid(ln, list)) { - return (FAILURE); - } - - ok: nLNode = emalloc(sizeof(*nLNode)); - nLNode->datum = d; nLNode->useCount = nLNode->flags = 0; @@ -105,6 +91,4 @@ Lst_Insert(Lst *list, LstNode *ln, void *d) list->firstPtr = nLNode; } } - - return (SUCCESS); }