mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-26 16:18:31 +00:00
Now that circular lists are gone remove stuff for them. Simplify
somewhat so that we can remove a local variable.
This commit is contained in:
parent
b9def06b29
commit
4ec22b1196
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=138581
@ -68,7 +68,6 @@ void
|
||||
Lst_Destroy(Lst *list, FreeProc *freeProc)
|
||||
{
|
||||
LstNode *ln;
|
||||
LstNode *tln;
|
||||
|
||||
if (!Lst_Valid(list)) {
|
||||
/*
|
||||
@ -78,22 +77,19 @@ Lst_Destroy(Lst *list, FreeProc *freeProc)
|
||||
return;
|
||||
}
|
||||
|
||||
if (list->lastPtr == NULL) {
|
||||
if (list->firstPtr == NULL) {
|
||||
free(list);
|
||||
return;
|
||||
}
|
||||
/* To ease scanning */
|
||||
list->lastPtr->nextPtr = NULL;
|
||||
|
||||
if (freeProc) {
|
||||
for (ln = list->firstPtr; ln != NULL; ln = tln) {
|
||||
tln = ln->nextPtr;
|
||||
if (freeProc != NOFREE) {
|
||||
while ((ln = list->firstPtr) != NULL) {
|
||||
list->firstPtr = ln->nextPtr;
|
||||
(*freeProc)(ln->datum);
|
||||
free(ln);
|
||||
}
|
||||
} else {
|
||||
for (ln = list->firstPtr; ln != NULL; ln = tln) {
|
||||
tln = ln->nextPtr;
|
||||
while ((ln = list->firstPtr) != NULL) {
|
||||
list->firstPtr = ln->nextPtr;
|
||||
free(ln);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user