From 57a03f348c7f91c1efe051fb9a901cd7c430b60b Mon Sep 17 00:00:00 2001
From: ENGO150 <v.smejkal06@gmail.com>
Date: Thu, 13 Apr 2023 16:42:02 +0200
Subject: [PATCH] implemented why2_list_t in why2_list_remove_back

---
 src/core/lib/utils/llist.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/core/lib/utils/llist.c b/src/core/lib/utils/llist.c
index 81ad054..76e49f1 100644
--- a/src/core/lib/utils/llist.c
+++ b/src/core/lib/utils/llist.c
@@ -80,18 +80,19 @@ void why2_list_remove(why2_list_t *list, why2_node_t *node)
     free(node);
 }
 
-void why2_list_remove_back(why2_node_t *llist_head)
+void why2_list_remove_back(why2_list_t *list)
 {
-    if (llist_head == NULL) return; //EMPTY LIST
+    why2_node_t *head = list -> head;
+    if (head == NULL) return; //EMPTY LIST
 
-    why2_node_t *buffer = llist_head;
+    why2_node_t *buffer = head;
     why2_node_t *deallocating_node;
 
     if (buffer -> next == NULL) //ONLY ONE NODE
     {
         deallocating_node = buffer;
 
-        llist_head = NULL;
+        head = NULL;
     } else
     {
         while (buffer -> next -> next != NULL) buffer = buffer -> next; //GO TO THE NODE BEFORE END