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:
parent
c4ddb6888a
commit
c37538aa75
@ -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
|
if (value != buffer -> value) buffer = NULL; //PREVENT FROM RETURNING INVALID NODE
|
||||||
|
|
||||||
return buffer;
|
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;
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user