From: cloudwalk Date: Tue, 8 Sep 2020 13:19:27 +0000 (+0000) Subject: com_list: Rename Delete to Delete_Init and implement the actual Delete X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=5cfa54f9eccab3ceabe2c3fb1b96bcd714f6c129;p=xonotic%2Fdarkplaces.git com_list: Rename Delete to Delete_Init and implement the actual Delete git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12915 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/com_list.c b/com_list.c index cb001480..a28a83da 100644 --- a/com_list.c +++ b/com_list.c @@ -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) +{ + __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; @@ -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; - List_Delete(node2); + List_Delete_Init(node2); List_Replace(node1, node2); if(pos == node1) pos = node2; diff --git a/com_list.h b/com_list.h index eac28823..8ba08dc5 100644 --- a/com_list.h +++ b/com_list.h @@ -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_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);