aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2022-03-12 10:17:25 +0100
committerThomas Schmucker <ts@its1.de>2022-03-12 10:17:25 +0100
commit6a06c7048ef256796a1536aa50961896a54c2c7b (patch)
treefea87e427d709790240a42f0091b9df45ab24de7
parent011ef70f4c1b6ef8384a3573d93595b42dba4395 (diff)
downloaddata-structures-6a06c7048ef256796a1536aa50961896a54c2c7b.tar.gz
data-structures-6a06c7048ef256796a1536aa50961896a54c2c7b.tar.bz2
data-structures-6a06c7048ef256796a1536aa50961896a54c2c7b.zip
use list_add()
-rw-r--r--list.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/list.c b/list.c
index 5a6c732..d18dae4 100644
--- a/list.c
+++ b/list.c
@@ -43,11 +43,9 @@ list_insert_next(struct list_item *list, T data)
43{ 43{
44 struct list_item *new_item; 44 struct list_item *new_item;
45 45
46 new_item = malloc(sizeof *new_item); 46 new_item = list_add(list->next, data);
47 if ( new_item ) { 47 if ( new_item ) {
48 new_item->data = data; 48 list->next = new_item;
49 new_item->next = list->next;
50 list->next = new_item;
51 } 49 }
52 else { 50 else {
53 ERROR("out of memory"); 51 ERROR("out of memory");