Cleaning improved when quitting.
parent
22c097789f
commit
be71494725
|
@ -38,9 +38,12 @@ void visit_node_pre_order(node *q, void (*callback)(node *)) {
|
|||
void node_destroy(list *q) {
|
||||
void (*func)(node *) = (void (*)(node *))free;
|
||||
list *t = q;
|
||||
list *prev = NULL;
|
||||
while (t) {
|
||||
visit_node_post_order(t->node, func);
|
||||
prev = t;
|
||||
t = t->next;
|
||||
free(prev);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue