int main(int argc, char **argv) { Gen_list list = NULL; char str[] = "(15, 'c', (20, 'd', (30, 'f')), ('g', 'i'), 60)"; list = init_genlist(str); show_genlist(list); //显示广义表信息 destroy_genlist(&list); //广义表的销毁 return 0; }
/* * flush_genlist */ void flush_genlist(genlist_t *list) { genlist_entry_t *entry; entry = remove_genlist_head(list); while (entry) { kmem_free((void *)entry, sizeof (genlist_entry_t)); entry = remove_genlist_head(list); } init_genlist(list); }