defined why2_clean_memory

it should be complete now, time to implement it
This commit is contained in:
Václav Šmejkal 2023-02-02 16:53:25 +01:00
parent 790eada639
commit b49f582c5c
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -137,4 +137,20 @@ void why2_free(void *pointer)
if (node != NULL) remove_node(node); //REMOVE FROM LIST IF FOUND if (node != NULL) remove_node(node); //REMOVE FROM LIST IF FOUND
free(pointer); free(pointer);
}
void why2_clean_memory(char *identifier)
{
if (head == NULL) return; //LIST IS EMPTY
node_t *buffer = head;
while (buffer -> next != NULL) //GO TROUGH LIST
{
if (buffer -> identifier == identifier) remove_node(buffer);
buffer = buffer -> next;
}
if (buffer -> identifier == identifier) remove_node(buffer); //LAST NODE
} }