NSAPI_PUBLIC void ACL_ListDestroy(NSErr_t *errp, ACLListHandle_t *acl_list ) { ACLWrapper_t *wrapper; ACLWrapper_t *tmp_wrapper; ACLHandle_t *tmp_acl; if ( acl_list == NULL ) return; if ( acl_list->acl_sym_table ) { /* Destroy each entry in the symbol table */ symTableEnumerate(acl_list->acl_sym_table, 0, acl_hash_entry_destroy); /* Destory the hash table itself */ symTableDestroy(acl_list->acl_sym_table, 0); } ACL_EvalDestroyContext( (ACLListCache_t *)acl_list->cache ); wrapper = acl_list->acl_list_head; while ( wrapper ) { tmp_acl = wrapper->acl; tmp_wrapper = wrapper; wrapper = wrapper->wrap_next; PERM_FREE( tmp_wrapper ); ACL_AclDestroy(errp, tmp_acl ); } PERM_FREE( acl_list ); return; }
static void acl_symtab_destroy(ACLListHandle_t *acl_list) { /* Destroy each entry in the symbol table */ symTableEnumerate(acl_list->acl_sym_table, 0, acl_hash_entry_destroy); /* Destory the hash table itself */ symTableDestroy(acl_list->acl_sym_table, 0); acl_list->acl_sym_table = NULL; return; }
/* * Destroys an ACL List * * Input: * acl_list target list */ NSAPI_PUBLIC void ACL_ListDestroy(NSErr_t *errp, ACLListHandle_t *acl_list ) { ACLWrapper_t *wrapper; ACLWrapper_t *tmp_wrapper; ACLHandle_t *tmp_acl; // nothing to do? if ( acl_list == NULL ) // nothing to do. return; if (acl_list->ref_count != 0) { NS_ASSERT(acl_list->ref_count == 0); } if ( acl_list->acl_sym_table ) { /* Destroy each entry in the symbol table */ symTableEnumerate(acl_list->acl_sym_table, 0, acl_hash_entry_destroy); /* Destory the hash table itself */ symTableDestroy(acl_list->acl_sym_table, 0); } // destroy evaluation cache (if there) ACL_EvalDestroyContext( (ACLListCache_t *)acl_list->cache ); wrapper = acl_list->acl_list_head; while ( wrapper ) { tmp_acl = wrapper->acl; tmp_wrapper = wrapper; wrapper = wrapper->wrap_next; PERM_FREE( tmp_wrapper ); ACL_AclDestroy(errp, tmp_acl ); } PERM_FREE( acl_list ); return; }