Remove a double test for the same ptr != NULL and use the official

macro for this; reorder an if.
This commit is contained in:
harti 2004-12-01 17:44:04 +00:00
parent 44dde891d6
commit 72af789644

View File

@ -68,23 +68,22 @@ void
Lst_Destroy(Lst list, FreeProc *freeProc)
{
LstNode ln;
LstNode tln = NULL;
LstNode tln;
if (list == NULL || ! list) {
if (!Lst_Valid(list)) {
/*
* Note the check for l == (Lst)0 to catch uninitialized static Lst's.
* Note the check to catch uninitialized static Lst's.
* Gross, but useful.
*/
return;
}
/* To ease scanning */
if (list->lastPtr != NULL)
list->lastPtr->nextPtr = NULL;
else {
if (list->lastPtr == NULL) {
free(list);
return;
}
/* To ease scanning */
list->lastPtr->nextPtr = NULL;
if (freeProc) {
for (ln = list->firstPtr; ln != NULL; ln = tln) {