aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schmucker <ts@its1.de>2020-09-04 08:04:13 +0200
committerThomas Schmucker <ts@its1.de>2020-09-04 08:04:13 +0200
commitf7a3088da5a83565274b67f3d334a7b654502497 (patch)
treee9b080199aa195fc8ce15a970194231d8746a20f
parent526d1b1232c7d835dea5c00e91197861a2f19180 (diff)
downloaddata-structures-f7a3088da5a83565274b67f3d334a7b654502497.tar.gz
data-structures-f7a3088da5a83565274b67f3d334a7b654502497.tar.bz2
data-structures-f7a3088da5a83565274b67f3d334a7b654502497.zip
pop_front() entfernt ein Element aus der Liste, muss aber nicht immer dessen Daten zurückgeben!
-rw-r--r--list-tail-node.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/list-tail-node.c b/list-tail-node.c
index 52b93ce..c939b8d 100644
--- a/list-tail-node.c
+++ b/list-tail-node.c
@@ -75,7 +75,10 @@ list_pop_front(struct list *list, T *data)
75{ 75{
76 if ( list->head != NULL ) { 76 if ( list->head != NULL ) {
77 struct list_node *next = list->head->next; 77 struct list_node *next = list->head->next;
78 *data = list->head->data; 78
79 if ( data != NULL ) {
80 *data = list->head->data;
81 }
79 free(list->head); 82 free(list->head);
80 list->head = next; 83 list->head = next;
81 84