From 6ced2a50056acbf7caec404a1edfa3b07fa1ac5d Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Wed, 29 Dec 2021 10:48:03 +0100 Subject: feat: remove NULL-checks --- list-tail-node.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'list-tail-node.c') diff --git a/list-tail-node.c b/list-tail-node.c index 4e40912..edfcf31 100644 --- a/list-tail-node.c +++ b/list-tail-node.c @@ -33,7 +33,7 @@ create_node(struct list_node *next, T data) { struct list_node *node = malloc(sizeof *node); - if ( node != NULL ) { + if ( node ) { node->next = next; node->data = data; } @@ -47,7 +47,7 @@ list_push_back(struct list *list, T data) { struct list_node *node = create_node(NULL, data); - if ( node != NULL ) { + if ( node ) { if ( list->head == NULL ) { list->head = node; } @@ -68,7 +68,7 @@ list_push_front(struct list *list, T data) { struct list_node *node = create_node(list->head, data); - if ( node != NULL ) { + if ( node ) { if ( list->head == NULL ) { // Einfügen in eine leere Liste? list->tail = node; } @@ -84,10 +84,10 @@ list_push_front(struct list *list, T data) bool list_pop_front(struct list *list, T *data) { - if ( list->head != NULL ) { + if ( list->head ) { struct list_node *next = list->head->next; - if ( data != NULL ) { + if ( data ) { *data = list->head->data; } free(list->head); @@ -111,7 +111,7 @@ list_insert_next(struct list *list, struct list_node *node, T data) else { struct list_node *new_node = create_node(node->next, data); - if ( new_node != NULL ) { + if ( new_node ) { if ( node->next == NULL ) { // Am Ende einfügen list->tail = new_node; } @@ -132,7 +132,7 @@ list_delete_next(struct list *list, struct list_node *node, T *data) list_pop_front(list, data); } else { - if ( node->next != NULL ) { + if ( node->next ) { struct list_node *old_node = node->next; node->next = node->next->next; @@ -140,7 +140,7 @@ list_delete_next(struct list *list, struct list_node *node, T *data) list->tail = node; } - if ( data != NULL ) { + if ( data ) { *data = old_node->data; } free(old_node); -- cgit v1.3