diff options
-rw-r--r-- | gdb/ChangeLog | 28 | ||||
-rw-r--r-- | gdb/bcache.c | 6 | ||||
-rw-r--r-- | gdb/defs.h | 5 | ||||
-rw-r--r-- | gdb/dwarf2loc.c | 2 | ||||
-rw-r--r-- | gdb/elfread.c | 6 | ||||
-rw-r--r-- | gdb/gdbtypes.c | 2 | ||||
-rw-r--r-- | gdb/i386-tdep.c | 2 | ||||
-rw-r--r-- | gdb/jit.c | 4 | ||||
-rw-r--r-- | gdb/minsyms.c | 2 | ||||
-rw-r--r-- | gdb/mt-tdep.c | 2 | ||||
-rw-r--r-- | gdb/opencl-lang.c | 2 | ||||
-rw-r--r-- | gdb/psymtab.c | 2 | ||||
-rw-r--r-- | gdb/regcache.c | 8 | ||||
-rw-r--r-- | gdb/registry.c | 2 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 2 | ||||
-rw-r--r-- | gdb/s390-linux-tdep.c | 2 | ||||
-rw-r--r-- | gdb/serial.c | 2 | ||||
-rw-r--r-- | gdb/solib-aix.c | 2 | ||||
-rw-r--r-- | gdb/spu-tdep.c | 2 | ||||
-rw-r--r-- | gdb/symfile.c | 6 |
20 files changed, 56 insertions, 33 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a55e19d..2247c79 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,33 @@ 2014-01-13 Tom Tromey <tromey@redhat.com> + * defs.h (XCALLOC): Remove. + * bcache.c (bcache_xmalloc): Use XCNEW, not XCALLOC. + (print_bcache_statistics): Use XCNEWVEC, not XCALLOC. + * dwarf2loc.c (allocate_piece_closure): Likewise. + * elfread.c (elf_symfile_segments): Likewise. + (elf_symfile_segments): Likewise. + * gdbtypes.c (copy_type_recursive): Likewise. + * i386-tdep.c (i386_gdbarch_init): Use XCNEW, not XCALLOC. + * jit.c (jit_frame_sniffer): Use XCNEWVEC, not XCALLOC. + * minsyms.c (prim_record_minimal_symbol_full): Use XCNEW, not + XCALLOC. + * mt-tdep.c (mt_gdbarch_init): Likewise. + * opencl-lang.c (allocate_lval_closure): Use XCNEWVEC, not + XCALLOC. + * psymtab.c (psymbol_compare): Use XCNEW, not XCALLOC. + * regcache.c (regcache_xmalloc_1): Use XCNEWVEC, not XCALLOC. + * registry.c (registry_alloc_data): Likewise. + * rs6000-tdep.c (rs6000_gdbarch_init): Use XCNEW, not XCALLOC. + * s390-linux-tdep.c (s390_gdbarch_init): Likewise. + * serial.c (serial_fdopen_ops): Likewise. + * solib-aix.c (solib_aix_get_section_offsets): Use XCNEWVEC, not + XCALLOC. + * spu-tdep.c (spu_gdbarch_init): Use XCNEW, not XCALLOC. + * symfile.c (default_symfile_segments): Use XCNEW and XCNEWVEC, + not XCALLOC. + +2014-01-13 Tom Tromey <tromey@redhat.com> + * defs.h (XMALLOC): Remove. * avr-tdep.c (avr_gdbarch_init): Use XNEW, not XMALLOC. * bfin-tdep.c (bfin_gdbarch_init): Likewise. diff --git a/gdb/bcache.c b/gdb/bcache.c index 3d1280a..99e9184 100644 --- a/gdb/bcache.c +++ b/gdb/bcache.c @@ -313,7 +313,7 @@ bcache_xmalloc (unsigned long (*hash_function)(const void *, int length), int length)) { /* Allocate the bcache pre-zeroed. */ - struct bcache *b = XCALLOC (1, struct bcache); + struct bcache *b = XCNEW (struct bcache); if (hash_function) b->hash_function = hash_function; @@ -372,8 +372,8 @@ print_bcache_statistics (struct bcache *c, char *type) lengths, and measure chain lengths. */ { unsigned int b; - int *chain_length = XCALLOC (c->num_buckets + 1, int); - int *entry_size = XCALLOC (c->unique_count + 1, int); + int *chain_length = XCNEWVEC (int, c->num_buckets + 1); + int *entry_size = XCNEWVEC (int, c->unique_count + 1); int stringi = 0; occupied_buckets = 0; @@ -553,11 +553,6 @@ enum val_prettyformat extern int longest_to_int (LONGEST); -/* Utility macros to allocate typed memory. Avoids errors like: - struct foo *foo = xmalloc (sizeof struct bar); and memset (foo, - sizeof (struct foo), 0). */ -#define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE))) - #include "common-utils.h" /* List of known OS ABIs. If you change this, make sure to update the diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c index 6185a6b..99a18a9 100644 --- a/gdb/dwarf2loc.c +++ b/gdb/dwarf2loc.c @@ -1421,7 +1421,7 @@ allocate_piece_closure (struct dwarf2_per_cu_data *per_cu, c->per_cu = per_cu; c->n_pieces = n_pieces; c->addr_size = addr_size; - c->pieces = XCALLOC (n_pieces, struct dwarf_expr_piece); + c->pieces = XCNEWVEC (struct dwarf_expr_piece, n_pieces); memcpy (c->pieces, pieces, n_pieces * sizeof (struct dwarf_expr_piece)); for (i = 0; i < n_pieces; ++i) diff --git a/gdb/elfread.c b/gdb/elfread.c index 4f27aff..d43a1f7 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -107,8 +107,8 @@ elf_symfile_segments (bfd *abfd) data = XCNEW (struct symfile_segment_data); data->num_segments = num_segments; - data->segment_bases = XCALLOC (num_segments, CORE_ADDR); - data->segment_sizes = XCALLOC (num_segments, CORE_ADDR); + data->segment_bases = XCNEWVEC (CORE_ADDR, num_segments); + data->segment_sizes = XCNEWVEC (CORE_ADDR, num_segments); for (i = 0; i < num_segments; i++) { @@ -117,7 +117,7 @@ elf_symfile_segments (bfd *abfd) } num_sections = bfd_count_sections (abfd); - data->segment_info = XCALLOC (num_sections, int); + data->segment_info = XCNEWVEC (int, num_sections); for (i = 0, sect = abfd->sections; sect != NULL; i++, sect = sect->next) { diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index e02b66c..042c17d 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -3700,7 +3700,7 @@ copy_type_recursive (struct objfile *objfile, int i, nfields; nfields = TYPE_NFIELDS (type); - TYPE_FIELDS (new_type) = XCALLOC (nfields, struct field); + TYPE_FIELDS (new_type) = XCNEWVEC (struct field, nfields); for (i = 0; i < nfields; i++) { TYPE_FIELD_ARTIFICIAL (new_type, i) = diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 9d1d9e0..4a5f652 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -7819,7 +7819,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* Allocate space for the new architecture. */ - tdep = XCALLOC (1, struct gdbarch_tdep); + tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); /* General-purpose registers. */ @@ -1184,8 +1184,8 @@ jit_frame_sniffer (const struct frame_unwind *self, *cache = XCNEW (struct jit_unwind_private); priv_data = *cache; priv_data->registers = - XCALLOC (gdbarch_num_regs (get_frame_arch (this_frame)), - struct gdb_reg_value *); + XCNEWVEC (struct gdb_reg_value *, + gdbarch_num_regs (get_frame_arch (this_frame))); priv_data->this_frame = this_frame; callbacks.priv_data = priv_data; diff --git a/gdb/minsyms.c b/gdb/minsyms.c index ee9575c..c7ae981 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -935,7 +935,7 @@ prim_record_minimal_symbol_full (const char *name, int name_len, int copy_name, if (msym_bunch_index == BUNCH_SIZE) { - new = XCALLOC (1, struct msym_bunch); + new = XCNEW (struct msym_bunch); msym_bunch_index = 0; new->next = msym_bunch; msym_bunch = new; diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index 2072528..e3786e8 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -1149,7 +1149,7 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* None found, create a new architecture from the information provided. */ - tdep = XCALLOC (1, struct gdbarch_tdep); + tdep = XCNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); set_gdbarch_float_format (gdbarch, floatformats_ieee_single); diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c index 4bcaf7e..2dd76fa 100644 --- a/gdb/opencl-lang.c +++ b/gdb/opencl-lang.c @@ -160,7 +160,7 @@ allocate_lval_closure (int *indices, int n, struct value *val) c->refc = 1; c->n = n; - c->indices = XCALLOC (n, int); + c->indices = XCNEWVEC (int, n); memcpy (c->indices, indices, n * sizeof (int)); value_incref (val); /* Increment the reference counter of the value. */ c->val = val; diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 34e833c..56fe409 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1530,7 +1530,7 @@ psymbol_compare (const void *addr1, const void *addr2, int length) struct psymbol_bcache * psymbol_bcache_init (void) { - struct psymbol_bcache *bcache = XCALLOC (1, struct psymbol_bcache); + struct psymbol_bcache *bcache = XCNEW (struct psymbol_bcache); bcache->bcache = bcache_xmalloc (psymbol_hash, psymbol_compare); return bcache; } diff --git a/gdb/regcache.c b/gdb/regcache.c index 1ddf9b0..8b588c6 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -223,16 +223,16 @@ regcache_xmalloc_1 (struct gdbarch *gdbarch, struct address_space *aspace, if (readonly_p) { regcache->registers - = XCALLOC (descr->sizeof_cooked_registers, gdb_byte); + = XCNEWVEC (gdb_byte, descr->sizeof_cooked_registers); regcache->register_status - = XCALLOC (descr->sizeof_cooked_register_status, signed char); + = XCNEWVEC (signed char, descr->sizeof_cooked_register_status); } else { regcache->registers - = XCALLOC (descr->sizeof_raw_registers, gdb_byte); + = XCNEWVEC (gdb_byte, descr->sizeof_raw_registers); regcache->register_status - = XCALLOC (descr->sizeof_raw_register_status, signed char); + = XCNEWVEC (signed char, descr->sizeof_raw_register_status); } regcache->aspace = aspace; regcache->ptid = minus_one_ptid; diff --git a/gdb/registry.c b/gdb/registry.c index ed614b9..2fd6033 100644 --- a/gdb/registry.c +++ b/gdb/registry.c @@ -51,7 +51,7 @@ registry_alloc_data (struct registry_data_registry *registry, { gdb_assert (fields->data == NULL); fields->num_data = registry->num_registrations; - fields->data = XCALLOC (fields->num_data, void *); + fields->data = XCNEWVEC (void *, fields->num_data); } void diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 0008f84..d7416e5 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3954,7 +3954,7 @@ rs6000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) - "set arch" trust blindly - GDB startup useless but harmless */ - tdep = XCALLOC (1, struct gdbarch_tdep); + tdep = XCNEW (struct gdbarch_tdep); tdep->wordsize = wordsize; tdep->soft_float = soft_float; tdep->vector_abi = vector_abi; diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c index 69befcf..b75c86a 100644 --- a/gdb/s390-linux-tdep.c +++ b/gdb/s390-linux-tdep.c @@ -3196,7 +3196,7 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } /* Otherwise create a new gdbarch for the specified machine type. */ - tdep = XCALLOC (1, struct gdbarch_tdep); + tdep = XCNEW (struct gdbarch_tdep); tdep->abi = tdep_abi; gdbarch = gdbarch_alloc (&info, tdep); diff --git a/gdb/serial.c b/gdb/serial.c index c87875f..2b1eced 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -263,7 +263,7 @@ serial_fdopen_ops (const int fd, const struct serial_ops *ops) if (!ops) return NULL; - scb = XCALLOC (1, struct serial); + scb = XCNEW (struct serial); scb->ops = ops; diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 8f335f6..78d2753 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -470,7 +470,7 @@ solib_aix_get_section_offsets (struct objfile *objfile, bfd *abfd = objfile->obfd; int i; - offsets = XCALLOC (objfile->num_sections, struct section_offsets); + offsets = XCNEWVEC (struct section_offsets, objfile->num_sections); /* .text */ diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 4d745d9..f096a2e 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -2658,7 +2658,7 @@ spu_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } /* None found, so create a new architecture. */ - tdep = XCALLOC (1, struct gdbarch_tdep); + tdep = XCNEW (struct gdbarch_tdep); tdep->id = id; gdbarch = gdbarch_alloc (&info, tdep); diff --git a/gdb/symfile.c b/gdb/symfile.c index 02471a4..a8bc3d8 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -801,11 +801,11 @@ default_symfile_segments (bfd *abfd) data = XCNEW (struct symfile_segment_data); data->num_segments = 1; - data->segment_bases = XCALLOC (1, CORE_ADDR); - data->segment_sizes = XCALLOC (1, CORE_ADDR); + data->segment_bases = XCNEW (CORE_ADDR); + data->segment_sizes = XCNEW (CORE_ADDR); num_sections = bfd_count_sections (abfd); - data->segment_info = XCALLOC (num_sections, int); + data->segment_info = XCNEWVEC (int, num_sections); for (i = 0, sect = abfd->sections; sect != NULL; i++, sect = sect->next) { |