static void __delete_all(t_avl const *const avl, t_node *const root) { if (root == nil) return; __delete_all(avl, root->node[0]); __delete_all(avl, root->node[1]); if (avl->hook_remove) avl->hook_remove(root->val); free(root); }
int svc_clear(void) { int rc = 0; if (_init() < 0) return -1; rc = __delete_all(SVC_TBL_NAME); __fini(); return rc; }
int mida_clear(void) { int rc = 0; if (_init() < 0) return -1; rc = __delete_all(MIDA_TBL_NAME); __fini(); return rc; }
void avl_delete(t_avl *const avl) { __delete_all(avl, (t_node *)avl->root); free(avl); }