mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Automatically free container elements if needed
This commit is contained in:
@@ -19,9 +19,12 @@ Toy_Stack* Toy_allocateStack() {
|
||||
}
|
||||
|
||||
void Toy_freeStack(Toy_Stack* stack) {
|
||||
//TODO: slip in a call to free the complex values here
|
||||
|
||||
if (stack != NULL) {
|
||||
//if some values will be removed, free them first
|
||||
for (unsigned int i = 0; i < stack->count; i++) {
|
||||
Toy_freeValue(stack->data[i]);
|
||||
}
|
||||
|
||||
free(stack);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user