diff --git a/src/core/lib/utils/llist.c b/src/core/lib/utils/llist.c index e437eb7..82a2120 100644 --- a/src/core/lib/utils/llist.c +++ b/src/core/lib/utils/llist.c @@ -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; } \ No newline at end of file