From 234d9500e3e2462a5404d5e675fa5a7b8038d059 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 2 Sep 2020 15:08:39 +0200 Subject: Feature: Der Code zum Einfügen und zum Löschen des nächsten Listenelements sollte so passen! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- list.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'list.c') diff --git a/list.c b/list.c index fb21779..da0c702 100644 --- a/list.c +++ b/list.c @@ -33,17 +33,16 @@ list_add(struct list_item *next, T data) } void -list_insert_next(struct list_item *node, T data) +list_insert_next(struct list_item *list, T data) { struct list_item *new_item; - // TODO: Debuggen und nochmal richtig drüber nachdenken! new_item = malloc(sizeof *new_item); if ( new_item != NULL ) { - new_item->next = node->next; new_item->data = data; - node->next = new_item; + new_item->next = list->next; + list->next = new_item; } else ERROR("out of memory"); @@ -76,7 +75,6 @@ list_delete(struct list_item *list, T data) void list_delete_next(struct list_item *list) { - // TODO: Debuggen und nochmal richtig drüber nachdenken! if ( list->next != NULL ) { struct list_item *temp = list->next; -- cgit v1.3