updated performance in why2_deallocate
now if you attempt to deallocate NULL, get_node doesn't go trough the whole list
This commit is contained in:
parent
b1062ad8df
commit
a0aabc547a
@ -90,7 +90,7 @@ void remove_node(node_t *node)
|
|||||||
|
|
||||||
node_t *get_node(void *pointer)
|
node_t *get_node(void *pointer)
|
||||||
{
|
{
|
||||||
if (head == NULL) return NULL; //EMPTY LIST
|
if (head == NULL || pointer == NULL) return NULL; //EMPTY LIST
|
||||||
|
|
||||||
node_t *buffer = head;
|
node_t *buffer = head;
|
||||||
while (buffer -> next != NULL)
|
while (buffer -> next != NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user