struct macro_table * new_macro_table (struct obstack *obstack, struct bcache *b, struct compunit_symtab *cust) { struct macro_table *t; /* First, get storage for the `struct macro_table' itself. */ if (obstack) t = obstack_alloc (obstack, sizeof (*t)); else t = xmalloc (sizeof (*t)); memset (t, 0, sizeof (*t)); t->obstack = obstack; t->bcache = b; t->main_source = NULL; t->compunit_symtab = cust; t->redef_ok = 0; t->definitions = (splay_tree_new_with_allocator (macro_tree_compare, ((splay_tree_delete_key_fn) macro_tree_delete_key), ((splay_tree_delete_value_fn) macro_tree_delete_value), ((splay_tree_allocate_fn) macro_alloc), ((splay_tree_deallocate_fn) macro_free), t)); return t; }
struct addrmap * addrmap_create_mutable (struct obstack *obstack) { struct addrmap_mutable *map = obstack_alloc (obstack, sizeof (*map)); map->addrmap.funcs = &addrmap_mutable_funcs; map->obstack = obstack; /* splay_tree_new_with_allocator uses the provided allocation function to allocate the main splay_tree structure itself, so our free list has to be initialized before we create the tree. */ map->free_nodes = NULL; map->tree = splay_tree_new_with_allocator (splay_compare_CORE_ADDR_ptr, NULL, /* no delete key */ NULL, /* no delete value */ splay_obstack_alloc, splay_obstack_free, map); return (struct addrmap *) map; }
/* First, get storage for the `struct macro_table' itself. */ if (obstack) t = XOBNEW (obstack, struct macro_table); else t = XNEW (struct macro_table); memset (t, 0, sizeof (*t)); t->obstack = obstack; t->bcache = b; t->main_source = NULL; t->compunit_symtab = cust; t->redef_ok = 0; t->definitions = (splay_tree_new_with_allocator (macro_tree_compare, ((splay_tree_delete_key_fn) macro_tree_delete_key), ((splay_tree_delete_value_fn) macro_tree_delete_value), ((splay_tree_allocate_fn) macro_alloc), ((splay_tree_deallocate_fn) macro_free), t)); return t; } void free_macro_table (struct macro_table *table) { /* Free the source file tree. */ free_macro_source_file (table->main_source); /* Free the table of macro definitions. */