diff options
Diffstat (limited to 'gdb/dictionary.c')
-rw-r--r-- | gdb/dictionary.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/gdb/dictionary.c b/gdb/dictionary.c index a16955a..1829b12 100644 --- a/gdb/dictionary.c +++ b/gdb/dictionary.c @@ -361,7 +361,7 @@ dict_create_hashed (struct obstack *obstack, struct symbol **buckets; const struct pending *list_counter; - retval = obstack_alloc (obstack, sizeof (struct dictionary)); + retval = XOBNEW (obstack, struct dictionary); DICT_VECTOR (retval) = &dict_hashed_vector; /* Calculate the number of symbols, and allocate space for them. */ @@ -373,7 +373,7 @@ dict_create_hashed (struct obstack *obstack, } nbuckets = DICT_HASHTABLE_SIZE (nsyms); DICT_HASHED_NBUCKETS (retval) = nbuckets; - buckets = obstack_alloc (obstack, nbuckets * sizeof (struct symbol *)); + buckets = XOBNEWVEC (obstack, struct symbol *, nbuckets); memset (buckets, 0, nbuckets * sizeof (struct symbol *)); DICT_HASHED_BUCKETS (retval) = buckets; @@ -399,9 +399,8 @@ dict_create_hashed (struct obstack *obstack, extern struct dictionary * dict_create_hashed_expandable (void) { - struct dictionary *retval; + struct dictionary *retval = XNEW (struct dictionary); - retval = xmalloc (sizeof (struct dictionary)); DICT_VECTOR (retval) = &dict_hashed_expandable_vector; DICT_HASHED_NBUCKETS (retval) = DICT_EXPANDABLE_INITIAL_CAPACITY; DICT_HASHED_BUCKETS (retval) = xcalloc (DICT_EXPANDABLE_INITIAL_CAPACITY, @@ -425,7 +424,7 @@ dict_create_linear (struct obstack *obstack, struct symbol **syms; const struct pending *list_counter; - retval = obstack_alloc (obstack, sizeof (struct dictionary)); + retval = XOBNEW (obstack, struct dictionary); DICT_VECTOR (retval) = &dict_linear_vector; /* Calculate the number of symbols, and allocate space for them. */ @@ -436,7 +435,7 @@ dict_create_linear (struct obstack *obstack, nsyms += list_counter->nsyms; } DICT_LINEAR_NSYMS (retval) = nsyms; - syms = obstack_alloc (obstack, nsyms * sizeof (struct symbol *)); + syms = XOBNEWVEC (obstack, struct symbol *, nsyms ); DICT_LINEAR_SYMS (retval) = syms; /* Now fill in the symbols. Start filling in from the back, so as @@ -464,9 +463,8 @@ dict_create_linear (struct obstack *obstack, struct dictionary * dict_create_linear_expandable (void) { - struct dictionary *retval; + struct dictionary *retval = XNEW (struct dictionary); - retval = xmalloc (sizeof (struct dictionary)); DICT_VECTOR (retval) = &dict_linear_expandable_vector; DICT_LINEAR_NSYMS (retval) = 0; DICT_LINEAR_EXPANDABLE_CAPACITY (retval) |