From 6a06c7048ef256796a1536aa50961896a54c2c7b Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sat, 12 Mar 2022 10:17:25 +0100 Subject: use list_add() --- list.c | 6 ++---- 1 file 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) { struct list_item *new_item; - new_item = malloc(sizeof *new_item); + new_item = list_add(list->next, data); if ( new_item ) { - new_item->data = data; - new_item->next = list->next; - list->next = new_item; + list->next = new_item; } else { ERROR("out of memory"); -- cgit v1.3