defined why2_list_get_size

not sure if this is correct lol

EDIT: It didn't work. I fixed it now lmao
This commit is contained in:
Václav Šmejkal 2024-04-27 12:20:28 +02:00
parent c4ddb6888a
commit c37538aa75
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -133,4 +133,22 @@ why2_node_t *why2_list_find(why2_list_t *list, void *value)
if (value != buffer -> value) buffer = NULL; //PREVENT FROM RETURNING INVALID NODE
return buffer;
}
unsigned long why2_list_get_size(why2_list_t *list)
{
unsigned long n = 0; //RETURNING SIZE
why2_node_t *head = list -> head;
if (head == NULL) return n; //EMPTY LIST
why2_node_t *buffer = head;
do
{
n++;
buffer = buffer -> next; //ITER
} while (buffer != NULL);
return n;
}