//Destroy a symbol table. void _symtable_destroy(dictionary* symtable){ printf("\n\nDestroy a symtable...\n\n"); dictionary_entry* entry; symbol* data; stub *st, *tmp; //Loop through the dictionary to get all values without relying on hash indices. while((entry = _dictionary_loop_get_entry(symtable)) != 0){ data = entry->data; if(data){ free(data->label); st = data->stubs; while(st){ tmp = st; st = tmp->next; free(tmp); } free(data); } } _dictionary_destroy(symtable); }
/** * Destroys the given template dictionary and any sub-dictionaries */ void ngt_dictionary_destroy(ngt_dictionary* dict) { _dictionary_destroy((void*)dict); }