]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
com_list: Rename Delete to Delete_Init and implement the actual Delete
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 8 Sep 2020 13:19:27 +0000 (13:19 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 8 Sep 2020 13:19:27 +0000 (13:19 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12915 d7cf8633-e32d-0410-b094-e92efae38249

com_list.c
com_list.h

index cb0014802516b9a712567abe910328528d6ea5ff..a28a83dabd4a991a8b1a99a7d34dbcbd3042bdb7 100644 (file)
@@ -70,9 +70,18 @@ static void __List_Delete_Node(llist_t *node)
 }
 
 /*
 }
 
 /*
- * Removes a node from its list.
+ * Removes a node from its list. Sets its pointers to NULL.
  */
 void List_Delete(llist_t *node)
  */
 void List_Delete(llist_t *node)
+{
+       __List_Delete_Node(node);
+       node->next = node->prev = NULL;
+}
+
+/*
+ * Removes a node from its list. Reinitialize it.
+ */
+void List_Delete_Init(llist_t *node)
 {
        __List_Delete_Node(node);
        node->next = node->prev = node;
 {
        __List_Delete_Node(node);
        node->next = node->prev = node;
@@ -96,7 +105,7 @@ void List_Replace(llist_t *old, llist_t *_new)
 void List_Swap(llist_t *node1, llist_t *node2)
 {
        llist_t *pos = node2->prev;
 void List_Swap(llist_t *node1, llist_t *node2)
 {
        llist_t *pos = node2->prev;
-       List_Delete(node2);
+       List_Delete_Init(node2);
        List_Replace(node1, node2);
        if(pos == node1)
                pos = node2;
        List_Replace(node1, node2);
        if(pos == node1)
                pos = node2;
index eac288232ffaa01e7274048628e2869848765efe..8ba08dc55a5d07aa02c81e19950d5fc97e9429cb 100644 (file)
@@ -41,6 +41,7 @@ typedef struct llist_s
 void List_Add(llist_t *node, llist_t *start);
 void List_Add_Tail(llist_t *node, llist_t *start);
 void List_Delete(llist_t *node);
 void List_Add(llist_t *node, llist_t *start);
 void List_Add_Tail(llist_t *node, llist_t *start);
 void List_Delete(llist_t *node);
+void List_Delete_Init(llist_t *node);
 void List_Replace(llist_t *old, llist_t *_new);
 void List_Swap(llist_t *node1, llist_t *node2);
 void List_Move(llist_t *list, llist_t *start);
 void List_Replace(llist_t *old, llist_t *_new);
 void List_Swap(llist_t *node1, llist_t *node2);
 void List_Move(llist_t *list, llist_t *start);