Nobody actually checked the return codes from Lst_Append and Lst_Insert
so don't return anything.
This commit is contained in:
parent
a007e1cba7
commit
972d6db1ca
@ -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. */
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user