summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/lst.lib/lstRemove.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/make/lst.lib/lstRemove.c')
-rw-r--r--usr.bin/make/lst.lib/lstRemove.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/usr.bin/make/lst.lib/lstRemove.c b/usr.bin/make/lst.lib/lstRemove.c
index a37cedd..5da603f 100644
--- a/usr.bin/make/lst.lib/lstRemove.c
+++ b/usr.bin/make/lst.lib/lstRemove.c
@@ -46,7 +46,8 @@ __FBSDID("$FreeBSD$");
* Remove an element from a list
*/
-#include "lstInt.h"
+#include "make.h"
+#include "lst.h"
/*-
*-----------------------------------------------------------------------
@@ -64,35 +65,32 @@ __FBSDID("$FreeBSD$");
*-----------------------------------------------------------------------
*/
ReturnStatus
-Lst_Remove(Lst l, LstNode ln)
+Lst_Remove(Lst list, LstNode ln)
{
- List list = (List) l;
- ListNode lNode = (ListNode) ln;
- if (!LstValid (l) ||
- !LstNodeValid (ln, l)) {
+ if (!Lst_Valid (list) || !Lst_NodeValid (ln, list)) {
return (FAILURE);
}
/*
* unlink it from the list
*/
- if (lNode->nextPtr != NULL) {
- lNode->nextPtr->prevPtr = lNode->prevPtr;
+ if (ln->nextPtr != NULL) {
+ ln->nextPtr->prevPtr = ln->prevPtr;
}
- if (lNode->prevPtr != NULL) {
- lNode->prevPtr->nextPtr = lNode->nextPtr;
+ if (ln->prevPtr != NULL) {
+ ln->prevPtr->nextPtr = ln->nextPtr;
}
/*
* if either the firstPtr or lastPtr of the list point to this node,
* adjust them accordingly
*/
- if (list->firstPtr == lNode) {
- list->firstPtr = lNode->nextPtr;
+ if (list->firstPtr == ln) {
+ list->firstPtr = ln->nextPtr;
}
- if (list->lastPtr == lNode) {
- list->lastPtr = lNode->prevPtr;
+ if (list->lastPtr == ln) {
+ list->lastPtr = ln->prevPtr;
}
/*
@@ -101,19 +99,19 @@ Lst_Remove(Lst l, LstNode ln)
* previous one was non-existent (prevPtr == NULL), we set the
* end to be Unknown, since it is.
*/
- if (list->isOpen && (list->curPtr == lNode)) {
+ if (list->isOpen && (list->curPtr == ln)) {
list->curPtr = list->prevPtr;
if (list->curPtr == NULL) {
- list->atEnd = Unknown;
+ list->atEnd = LstUnknown;
}
}
/*
* the only way firstPtr can still point to ln is if ln is the last
- * node on the list (the list is circular, so lNode->nextptr == lNode in
+ * node on the list (the list is circular, so ln->nextptr == ln in
* this case). The list is, therefore, empty and is marked as such
*/
- if (list->firstPtr == lNode) {
+ if (list->firstPtr == ln) {
list->firstPtr = NULL;
}
@@ -121,12 +119,11 @@ Lst_Remove(Lst l, LstNode ln)
* note that the datum is unmolested. The caller must free it as
* necessary and as expected.
*/
- if (lNode->useCount == 0) {
- free (ln);
+ if (ln->useCount == 0) {
+ free(ln);
} else {
- lNode->flags |= LN_DELETED;
+ ln->flags |= LN_DELETED;
}
return (SUCCESS);
}
-
OpenPOWER on IntegriCloud