Skip to content
Snippets Groups Projects
Commit f8693ea6 authored by florian.burgener's avatar florian.burgener
Browse files

Fix missing empty list checks

parent f5cd8f09
Branches
No related tags found
No related merge requests found
......@@ -27,6 +27,10 @@ unsigned int list_count(element *head) {
}
element *list_move(element *head) {
if (list_empty(head)) {
return NULL;
}
return head->next;
}
......@@ -59,6 +63,10 @@ element *list_insert_before(element *head, int data) {
}
element *list_search(element *head, int data, int (*compare)(int, int)) {
if (list_empty(head)) {
return NULL;
}
element *iterator = head;
do {
......@@ -91,6 +99,10 @@ element *list_remove(element *head, int data, int (*compare)(int, int)) {
}
void list_free(element *head) {
if (list_empty(head)) {
return;
}
element *iterator = head;
do {
......@@ -101,6 +113,10 @@ void list_free(element *head) {
}
void list_process(element *head, int (*action)(int)) {
if (list_empty(head)) {
return;
}
element *iterator = head;
do {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment