static void avl_free ( AvlNode* nd, void(*kFin)(Word), void(*vFin)(Word), void(*dealloc)(void*) ) { if (!nd) return; if (nd->left) avl_free(nd->left, kFin, vFin, dealloc); if (nd->right) avl_free(nd->right, kFin, vFin, dealloc); if (kFin) kFin( nd->key ); if (vFin) vFin( nd->val ); memset(nd, 0, sizeof(AvlNode)); dealloc(nd); }
static void avl_free ( AvlNode* nd, void(*kFin)(UWord), void(*vFin)(UWord), void(*dealloc)(void*) ) { if (!nd) return; if (nd->child[0]) avl_free(nd->child[0], kFin, vFin, dealloc); if (nd->child[1]) avl_free(nd->child[1], kFin, vFin, dealloc); if (kFin) kFin( nd->key ); if (vFin) vFin( nd->val ); VG_(memset)(nd, 0, sizeof(AvlNode)); dealloc(nd); }