changeset 689:9c61834c191b

Remove th_llist_delete() and th_llist_delete_node() and rename th_llist_delete_node_fast() to th_llist_delete_node().
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Mar 2020 15:20:49 +0200
parents a54298eef91a
children 953e16582f25
files th_datastruct.c th_datastruct.h th_network.c
diffstat 3 files changed, 2 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/th_datastruct.c	Fri Mar 06 20:55:43 2020 +0200
+++ b/th_datastruct.c	Mon Mar 09 15:20:49 2020 +0200
@@ -155,7 +155,7 @@
 
 
 */
-void th_llist_delete_node_fast(th_llist_t **list, th_llist_t *node)
+void th_llist_delete_node(th_llist_t **list, th_llist_t *node)
 {
     if (node == *list)
     {
@@ -186,42 +186,6 @@
 }
 
 
-void th_llist_delete_node(th_llist_t **list, th_llist_t *node)
-{
-    th_llist_t *curr = *list;
-
-    while (curr != NULL)
-    {
-        th_llist_t *next = curr->next;
-        if (curr == node)
-        {
-            th_llist_delete_node_fast(list, curr);
-            th_free(node);
-            break;
-        }
-        curr = next;
-    }
-}
-
-
-void th_llist_delete(th_llist_t **list, const void *data)
-{
-    th_llist_t *curr = *list;
-
-    while (curr != NULL)
-    {
-        th_llist_t *next = curr->next;
-        if (curr->data == data)
-        {
-            th_llist_delete_node_fast(list, curr);
-            th_free(curr);
-            break;
-        }
-        curr = next;
-    }
-}
-
-
 th_llist_t * th_llist_get_nth(th_llist_t *list, const size_t n)
 {
     th_llist_t *curr = list;
--- a/th_datastruct.h	Fri Mar 06 20:55:43 2020 +0200
+++ b/th_datastruct.h	Mon Mar 09 15:20:49 2020 +0200
@@ -37,9 +37,7 @@
 th_llist_t *   th_llist_append(th_llist_t **list, void *data);
 void           th_llist_prepend_node(th_llist_t **list, th_llist_t *node);
 th_llist_t *   th_llist_prepend(th_llist_t **list, void *data);
-void           th_llist_delete(th_llist_t **list, const void *data);
 void           th_llist_delete_node(th_llist_t **list, th_llist_t *node);
-void           th_llist_delete_node_fast(th_llist_t **list, th_llist_t *node);
 
 th_llist_t *   th_llist_get_nth(th_llist_t *list, const size_t n);
 size_t         th_llist_length(const th_llist_t *list);
--- a/th_network.c	Fri Mar 06 20:55:43 2020 +0200
+++ b/th_network.c	Mon Mar 09 15:20:49 2020 +0200
@@ -711,7 +711,7 @@
     {
         // Remove from linked list
         if (conn->node != NULL)
-            th_llist_delete_node_fast(&th_conn_list, conn->node);
+            th_llist_delete_node(&th_conn_list, conn->node);
 
         // Free connection data
         th_conn_free_nodelete(conn);