static void delete_bucket_list(struct bucket* b) { if(b == NULL) { return; } delete_bucket_list(b->next); debug("Unloading: '%s'", b->key); fpath ext; SDL_PathFileExtension(ext.ptr, b->key); for(int i = 0; i < num_asset_handlers; i++) { asset_handler handler = asset_handlers[i]; if (strcmp(ext.ptr, handler.extension) == 0) { bucket_delete_with(b, handler.del_func); break; } } }
void dict_remove_with(dict* d, char* key, void func(void*)) { int index = hash(key, d->size); struct bucket* b = d->buckets[index]; struct bucket** p = &d->buckets[index]; while(true) { if(b == NULL) { return; } if(strcmp(b->key, key) == 0) { *p = b->next; bucket_delete_with(b, func); return; } p = &b->next; b = b->next; } }