diff options
author | Tom Tromey <tromey@redhat.com> | 2013-12-28 15:31:23 -0700 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-01-13 07:31:28 -0700 |
commit | 70ba0933adb6b8d64b0687289d51837a58b804f9 (patch) | |
tree | 82e08cabb054d6942c907d54d0e91924f4a8b5dd | |
parent | 41bf6acad7b02f67240f4cf84f066078f9ed7116 (diff) | |
download | gdb-70ba0933adb6b8d64b0687289d51837a58b804f9.zip gdb-70ba0933adb6b8d64b0687289d51837a58b804f9.tar.gz gdb-70ba0933adb6b8d64b0687289d51837a58b804f9.tar.bz2 |
replace XMALLOC with XNEW
This replaces XMALLOC with XNEW, and removes XMALLOC. The only
non-mechanical bit here was remembering to edit gdbarch.sh.
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.
* cli-out.c (struct ui_out *): Likewise.
* cli/cli-dump.c (add_dump_command): Likewise.
(add_dump_command): Likewise.
* complaints.c (get_complaints): Likewise.
(find_complaint): Likewise.
* dwarf2-frame.c (execute_cfa_program): Likewise.
* dwarf2read.c (abbrev_table_read_table): Likewise.
* gdbarch.sh: Likewise.
* gdbarch.c: Rebuild.
* inf-ttrace.c (inf_ttrace_add_page): Likewise.
* interps.c (interp_new): Likewise.
* lm32-tdep.c (lm32_gdbarch_init): Likewise.
* m32r-tdep.c (m32r_gdbarch_init): Likewise.
* mi/mi-console.c (mi_console_file_new): Likewise.
* mi/mi-interp.c (mi_interpreter_init): Likewise.
* mi/mi-out.c (mi_out_new): Likewise.
* mi/mi-parse.c (mi_parse): Likewise.
* microblaze-tdep.c (microblaze_gdbarch_init): Likewise.
* moxie-tdep.c (moxie_gdbarch_init): Likewise.
* observer.c (xalloc_observer_list_node): Likewise.
* regcache.c (regcache_xmalloc_1): Likewise.
* reggroups.c (reggroup_new): Likewise.
(_initialize_reggroup): Likewise.
* registry.c (register_data_with_cleanup): Likewise.
* remote.c (remote_notif_stop_alloc_reply): Likewise.
* ser-base.c (serial_ttystate): Likewise.
* ser-mingw.c (make_pipe_state): Likewise.
* ser-pipe.c (pipe_open): Likewise.
* serial.c (serial_open): Likewise.
* sh64-tdep.c (sh64_gdbarch_init): Likewise.
* tui/tui-data.c (tui_alloc_generic_win_info): Likewise.
(tui_alloc_win_info): Likewise.
(tui_add_content_elements): Likewise.
* tui/tui-file.c (tui_file_new): Likewise.
* tui/tui-out.c (tui_out_new): Likewise.
* ui-file.c (mem_file_new): Likewise.
* ui-out.c (push_level): Likewise.
(make_cleanup_ui_out_end): Likewise.
(append_header_to_list): Likewise.
(ui_out_new): Likewise.
* user-regs.c (user_reg_add_builtin): Likewise.
37 files changed, 108 insertions, 62 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index debaaff..a55e19d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,52 @@ 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. + * cli-out.c (struct ui_out *): Likewise. + * cli/cli-dump.c (add_dump_command): Likewise. + (add_dump_command): Likewise. + * complaints.c (get_complaints): Likewise. + (find_complaint): Likewise. + * dwarf2-frame.c (execute_cfa_program): Likewise. + * dwarf2read.c (abbrev_table_read_table): Likewise. + * gdbarch.sh: Likewise. + * gdbarch.c: Rebuild. + * inf-ttrace.c (inf_ttrace_add_page): Likewise. + * interps.c (interp_new): Likewise. + * lm32-tdep.c (lm32_gdbarch_init): Likewise. + * m32r-tdep.c (m32r_gdbarch_init): Likewise. + * mi/mi-console.c (mi_console_file_new): Likewise. + * mi/mi-interp.c (mi_interpreter_init): Likewise. + * mi/mi-out.c (mi_out_new): Likewise. + * mi/mi-parse.c (mi_parse): Likewise. + * microblaze-tdep.c (microblaze_gdbarch_init): Likewise. + * moxie-tdep.c (moxie_gdbarch_init): Likewise. + * observer.c (xalloc_observer_list_node): Likewise. + * regcache.c (regcache_xmalloc_1): Likewise. + * reggroups.c (reggroup_new): Likewise. + (_initialize_reggroup): Likewise. + * registry.c (register_data_with_cleanup): Likewise. + * remote.c (remote_notif_stop_alloc_reply): Likewise. + * ser-base.c (serial_ttystate): Likewise. + * ser-mingw.c (make_pipe_state): Likewise. + * ser-pipe.c (pipe_open): Likewise. + * serial.c (serial_open): Likewise. + * sh64-tdep.c (sh64_gdbarch_init): Likewise. + * tui/tui-data.c (tui_alloc_generic_win_info): Likewise. + (tui_alloc_win_info): Likewise. + (tui_add_content_elements): Likewise. + * tui/tui-file.c (tui_file_new): Likewise. + * tui/tui-out.c (tui_out_new): Likewise. + * ui-file.c (mem_file_new): Likewise. + * ui-out.c (push_level): Likewise. + (make_cleanup_ui_out_end): Likewise. + (append_header_to_list): Likewise. + (ui_out_new): Likewise. + * user-regs.c (user_reg_add_builtin): Likewise. + +2014-01-13 Tom Tromey <tromey@redhat.com> + * defs.h (XZALLOC): Remove. * ada-lang.c (get_ada_inferior_data): Use XCNEW, not XZALLOC. * ada-tasks.c (get_ada_tasks_pspace_data): Likewise. diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c index cb330ea..e863678 100644 --- a/gdb/avr-tdep.c +++ b/gdb/avr-tdep.c @@ -1377,7 +1377,7 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) } /* None found, create a new architecture from the information provided. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); tdep->call_length = call_length; diff --git a/gdb/bfin-tdep.c b/gdb/bfin-tdep.c index d64da0d..3fa8173 100644 --- a/gdb/bfin-tdep.c +++ b/gdb/bfin-tdep.c @@ -818,7 +818,7 @@ bfin_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; } - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); tdep->bfin_abi = abi; diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 491d77b..b936f30 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -393,7 +393,7 @@ struct ui_out * cli_out_new (struct ui_file *stream) { int flags = ui_source_list; - cli_out_data *data = XMALLOC (cli_out_data); + cli_out_data *data = XNEW (cli_out_data); cli_out_data_ctor (data, stream); return ui_out_new (&cli_ui_out_impl, data, flags); diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c index c3c2200..005e207 100644 --- a/gdb/cli/cli-dump.c +++ b/gdb/cli/cli-dump.c @@ -396,7 +396,7 @@ add_dump_command (char *name, void (*func) (char *args, char *mode), c = add_cmd (name, all_commands, NULL, descr, &dump_cmdlist); c->completer = filename_completer; - d = XMALLOC (struct dump_context); + d = XNEW (struct dump_context); d->func = func; d->mode = FOPEN_WB; set_cmd_context (c, d); @@ -404,7 +404,7 @@ add_dump_command (char *name, void (*func) (char *args, char *mode), c = add_cmd (name, all_commands, NULL, descr, &append_cmdlist); c->completer = filename_completer; - d = XMALLOC (struct dump_context); + d = XNEW (struct dump_context); d->func = func; d->mode = FOPEN_AB; set_cmd_context (c, d); diff --git a/gdb/complaints.c b/gdb/complaints.c index 64a1bc1..92a3ef6 100644 --- a/gdb/complaints.c +++ b/gdb/complaints.c @@ -112,7 +112,7 @@ get_complaints (struct complaints **c) { if ((*c) != NULL) return (*c); - (*c) = XMALLOC (struct complaints); + (*c) = XNEW (struct complaints); (*c)->root = &complaint_sentinel; (*c)->series = ISOLATED_MESSAGE; (*c)->explanation = NULL; @@ -140,7 +140,7 @@ find_complaint (struct complaints *complaints, const char *file, } /* Oops not seen before, fill in a new complaint. */ - complaint = XMALLOC (struct complain); + complaint = XNEW (struct complain); complaint->fmt = fmt; complaint->file = file; complaint->line = line; @@ -556,7 +556,6 @@ 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 XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE))) #define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE))) #include "common-utils.h" diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c index 3dcaf27..d6d1bf7 100644 --- a/gdb/dwarf2-frame.c +++ b/gdb/dwarf2-frame.c @@ -518,7 +518,7 @@ execute_cfa_program (struct dwarf2_fde *fde, const gdb_byte *insn_ptr, { struct dwarf2_frame_state_reg_info *new_rs; - new_rs = XMALLOC (struct dwarf2_frame_state_reg_info); + new_rs = XNEW (struct dwarf2_frame_state_reg_info); *new_rs = fs->regs; fs->regs.reg = dwarf2_frame_state_copy_regs (&fs->regs); fs->regs.prev = new_rs; diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 23bcfe0..cbe04be 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -14724,7 +14724,7 @@ abbrev_table_read_table (struct dwarf2_section_info *section, struct attr_abbrev *cur_attrs; unsigned int allocated_attrs; - abbrev_table = XMALLOC (struct abbrev_table); + abbrev_table = XNEW (struct abbrev_table); abbrev_table->offset = offset; obstack_init (&abbrev_table->abbrev_obstack); abbrev_table->abbrevs = obstack_alloc (&abbrev_table->abbrev_obstack, diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index a605c7d..694fc0d 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -505,7 +505,7 @@ gdbarch_alloc (const struct gdbarch_info *info, /* Create an obstack for allocating all the per-architecture memory, then use that to allocate the architecture vector. */ - struct obstack *obstack = XMALLOC (struct obstack); + struct obstack *obstack = XNEW (struct obstack); obstack_init (obstack); gdbarch = obstack_alloc (obstack, sizeof (*gdbarch)); memset (gdbarch, 0, sizeof (*gdbarch)); @@ -4490,9 +4490,9 @@ gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init, for (curr = &gdbarch_data_registry.registrations; (*curr) != NULL; curr = &(*curr)->next); - (*curr) = XMALLOC (struct gdbarch_data_registration); + (*curr) = XNEW (struct gdbarch_data_registration); (*curr)->next = NULL; - (*curr)->data = XMALLOC (struct gdbarch_data); + (*curr)->data = XNEW (struct gdbarch_data); (*curr)->data->index = gdbarch_data_registry.nr++; (*curr)->data->pre_init = pre_init; (*curr)->data->post_init = post_init; @@ -4661,7 +4661,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture, bfd_arch_info->printable_name, host_address_to_string (init)); /* Append it */ - (*curr) = XMALLOC (struct gdbarch_registration); + (*curr) = XNEW (struct gdbarch_registration); (*curr)->bfd_architecture = bfd_architecture; (*curr)->init = init; (*curr)->dump_tdep = dump_tdep; @@ -4805,7 +4805,7 @@ gdbarch_find_by_info (struct gdbarch_info info) /* Insert the new architecture into the front of the architecture list (keep the list sorted Most Recently Used). */ { - struct gdbarch_list *this = XMALLOC (struct gdbarch_list); + struct gdbarch_list *this = XNEW (struct gdbarch_list); this->next = rego->arches; this->gdbarch = new_gdbarch; rego->arches = this; diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index ecbede6..ec54d6f 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -1645,7 +1645,7 @@ gdbarch_alloc (const struct gdbarch_info *info, /* Create an obstack for allocating all the per-architecture memory, then use that to allocate the architecture vector. */ - struct obstack *obstack = XMALLOC (struct obstack); + struct obstack *obstack = XNEW (struct obstack); obstack_init (obstack); gdbarch = obstack_alloc (obstack, sizeof (*gdbarch)); memset (gdbarch, 0, sizeof (*gdbarch)); @@ -2005,9 +2005,9 @@ gdbarch_data_register (gdbarch_data_pre_init_ftype *pre_init, for (curr = &gdbarch_data_registry.registrations; (*curr) != NULL; curr = &(*curr)->next); - (*curr) = XMALLOC (struct gdbarch_data_registration); + (*curr) = XNEW (struct gdbarch_data_registration); (*curr)->next = NULL; - (*curr)->data = XMALLOC (struct gdbarch_data); + (*curr)->data = XNEW (struct gdbarch_data); (*curr)->data->index = gdbarch_data_registry.nr++; (*curr)->data->pre_init = pre_init; (*curr)->data->post_init = post_init; @@ -2176,7 +2176,7 @@ gdbarch_register (enum bfd_architecture bfd_architecture, bfd_arch_info->printable_name, host_address_to_string (init)); /* Append it */ - (*curr) = XMALLOC (struct gdbarch_registration); + (*curr) = XNEW (struct gdbarch_registration); (*curr)->bfd_architecture = bfd_architecture; (*curr)->init = init; (*curr)->dump_tdep = dump_tdep; @@ -2320,7 +2320,7 @@ gdbarch_find_by_info (struct gdbarch_info info) /* Insert the new architecture into the front of the architecture list (keep the list sorted Most Recently Used). */ { - struct gdbarch_list *this = XMALLOC (struct gdbarch_list); + struct gdbarch_list *this = XNEW (struct gdbarch_list); this->next = rego->arches; this->gdbarch = new_gdbarch; rego->arches = this; diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index a1c761b..fbc7ed3 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -195,7 +195,7 @@ inf_ttrace_add_page (pid_t pid, CORE_ADDR addr) addr, 0, (uintptr_t)&prot) == -1) perror_with_name (("ttrace")); - page = XMALLOC (struct inf_ttrace_page); + page = XNEW (struct inf_ttrace_page); page->addr = addr; page->prot = prot; page->refcount = 0; diff --git a/gdb/interps.c b/gdb/interps.c index 6d0a76f..e446747 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -93,7 +93,7 @@ interp_new (const char *name, const struct interp_procs *procs) { struct interp *new_interp; - new_interp = XMALLOC (struct interp); + new_interp = XNEW (struct interp); new_interp->name = xstrdup (name); new_interp->data = NULL; diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c index 3ac7f89..bdd5477 100644 --- a/gdb/lm32-tdep.c +++ b/gdb/lm32-tdep.c @@ -527,7 +527,7 @@ lm32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* None found, create a new architecture from the information provided. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); /* Type sizes. */ diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c index efea816..0ba1276 100644 --- a/gdb/m32r-tdep.c +++ b/gdb/m32r-tdep.c @@ -917,7 +917,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* Allocate space for the new architecture. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); set_gdbarch_read_pc (gdbarch, m32r_read_pc); diff --git a/gdb/mi/mi-console.c b/gdb/mi/mi-console.c index d2b8491..dbad199 100644 --- a/gdb/mi/mi-console.c +++ b/gdb/mi/mi-console.c @@ -52,7 +52,7 @@ struct ui_file * mi_console_file_new (struct ui_file *raw, const char *prefix, char quote) { struct ui_file *ui_file = ui_file_new (); - struct mi_console_file *mi_console = XMALLOC (struct mi_console_file); + struct mi_console_file *mi_console = XNEW (struct mi_console_file); mi_console->magic = &mi_console_file_magic; mi_console->raw = raw; diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index c13c0f1..25bf0a1 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -83,7 +83,7 @@ static int report_initial_inferior (struct inferior *inf, void *closure); static void * mi_interpreter_init (struct interp *interp, int top_level) { - struct mi_interp *mi = XMALLOC (struct mi_interp); + struct mi_interp *mi = XNEW (struct mi_interp); const char *name; int mi_version; diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index 4723d06..a8a3d8d 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -411,7 +411,7 @@ mi_out_new (int mi_version) { int flags = 0; - mi_out_data *data = XMALLOC (mi_out_data); + mi_out_data *data = XNEW (mi_out_data); data->suppress_field_separator = 0; data->suppress_output = 0; data->mi_version = mi_version; diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c index 73151c2..161a16a 100644 --- a/gdb/mi/mi-parse.c +++ b/gdb/mi/mi-parse.c @@ -237,7 +237,7 @@ struct mi_parse * mi_parse (const char *cmd, char **token) { const char *chp; - struct mi_parse *parse = XMALLOC (struct mi_parse); + struct mi_parse *parse = XNEW (struct mi_parse); struct cleanup *cleanup; memset (parse, 0, sizeof (*parse)); diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index efca90d..14c1b52 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -676,7 +676,7 @@ microblaze_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* Allocate space for the new architecture. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); set_gdbarch_long_double_bit (gdbarch, 128); diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c index e1992f9..793e7a4 100644 --- a/gdb/moxie-tdep.c +++ b/gdb/moxie-tdep.c @@ -1112,7 +1112,7 @@ moxie_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) return arches->gdbarch; /* Allocate space for the new architecture. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); set_gdbarch_read_pc (gdbarch, moxie_read_pc); diff --git a/gdb/observer.c b/gdb/observer.c index 6217c6b..bd7b7ec 100644 --- a/gdb/observer.c +++ b/gdb/observer.c @@ -89,9 +89,9 @@ struct observer_list static struct observer_list * xalloc_observer_list_node (void) { - struct observer_list *node = XMALLOC (struct observer_list); + struct observer_list *node = XNEW (struct observer_list); - node->observer = XMALLOC (struct observer); + node->observer = XNEW (struct observer); return node; } diff --git a/gdb/regcache.c b/gdb/regcache.c index 6c5915b..1ddf9b0 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -217,7 +217,7 @@ regcache_xmalloc_1 (struct gdbarch *gdbarch, struct address_space *aspace, gdb_assert (gdbarch != NULL); descr = regcache_descr (gdbarch); - regcache = XMALLOC (struct regcache); + regcache = XNEW (struct regcache); regcache->descr = descr; regcache->readonly_p = readonly_p; if (readonly_p) diff --git a/gdb/reggroups.c b/gdb/reggroups.c index 94f2a48..41ec41a 100644 --- a/gdb/reggroups.c +++ b/gdb/reggroups.c @@ -39,7 +39,7 @@ struct reggroup struct reggroup * reggroup_new (const char *name, enum reggroup_type type) { - struct reggroup *group = XMALLOC (struct reggroup); + struct reggroup *group = XNEW (struct reggroup); group->name = name; group->type = type; @@ -277,13 +277,13 @@ _initialize_reggroup (void) reggroups_data = gdbarch_data_register_post_init (reggroups_init); /* The pre-defined list of groups. */ - add_group (&default_groups, general_reggroup, XMALLOC (struct reggroup_el)); - add_group (&default_groups, float_reggroup, XMALLOC (struct reggroup_el)); - add_group (&default_groups, system_reggroup, XMALLOC (struct reggroup_el)); - add_group (&default_groups, vector_reggroup, XMALLOC (struct reggroup_el)); - add_group (&default_groups, all_reggroup, XMALLOC (struct reggroup_el)); - add_group (&default_groups, save_reggroup, XMALLOC (struct reggroup_el)); - add_group (&default_groups, restore_reggroup, XMALLOC (struct reggroup_el)); + add_group (&default_groups, general_reggroup, XNEW (struct reggroup_el)); + add_group (&default_groups, float_reggroup, XNEW (struct reggroup_el)); + add_group (&default_groups, system_reggroup, XNEW (struct reggroup_el)); + add_group (&default_groups, vector_reggroup, XNEW (struct reggroup_el)); + add_group (&default_groups, all_reggroup, XNEW (struct reggroup_el)); + add_group (&default_groups, save_reggroup, XNEW (struct reggroup_el)); + add_group (&default_groups, restore_reggroup, XNEW (struct reggroup_el)); add_cmd ("reggroups", class_maintenance, maintenance_print_reggroups, _("\ diff --git a/gdb/registry.c b/gdb/registry.c index 1a3c295..ed614b9 100644 --- a/gdb/registry.c +++ b/gdb/registry.c @@ -35,9 +35,9 @@ register_data_with_cleanup (struct registry_data_registry *registry, curr = &(*curr)->next) ; - *curr = XMALLOC (struct registry_data_registration); + *curr = XNEW (struct registry_data_registration); (*curr)->next = NULL; - (*curr)->data = XMALLOC (struct registry_data); + (*curr)->data = XNEW (struct registry_data); (*curr)->data->index = registry->num_registrations++; (*curr)->data->save = save; (*curr)->data->free = free; diff --git a/gdb/remote.c b/gdb/remote.c index 17edbd2..6560918 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -5408,7 +5408,7 @@ static struct notif_event * remote_notif_stop_alloc_reply (void) { struct notif_event *r - = (struct notif_event *) XMALLOC (struct stop_reply); + = (struct notif_event *) XNEW (struct stop_reply); r->dtr = stop_reply_dtr; diff --git a/gdb/ser-base.c b/gdb/ser-base.c index ae92dfb..b8f7fd2 100644 --- a/gdb/ser-base.c +++ b/gdb/ser-base.c @@ -498,14 +498,14 @@ serial_ttystate ser_base_get_tty_state (struct serial *scb) { /* Allocate a dummy. */ - return (serial_ttystate) XMALLOC (int); + return (serial_ttystate) XNEW (int); } serial_ttystate ser_base_copy_tty_state (struct serial *scb, serial_ttystate ttystate) { /* Allocate another dummy. */ - return (serial_ttystate) XMALLOC (int); + return (serial_ttystate) XNEW (int); } int diff --git a/gdb/ser-mingw.c b/gdb/ser-mingw.c index 7247f50..db04999 100644 --- a/gdb/ser-mingw.c +++ b/gdb/ser-mingw.c @@ -788,7 +788,7 @@ struct pipe_state static struct pipe_state * make_pipe_state (void) { - struct pipe_state *ps = XMALLOC (struct pipe_state); + struct pipe_state *ps = XNEW (struct pipe_state); memset (ps, 0, sizeof (*ps)); ps->wait.read_event = INVALID_HANDLE_VALUE; diff --git a/gdb/ser-pipe.c b/gdb/ser-pipe.c index 9c5b99b..9568a26 100644 --- a/gdb/ser-pipe.c +++ b/gdb/ser-pipe.c @@ -134,7 +134,7 @@ pipe_open (struct serial *scb, const char *name) if (err_pdes[1] != -1) close (err_pdes[1]); /* :end chunk */ - state = XMALLOC (struct pipe_state); + state = XNEW (struct pipe_state); state->pid = pid; scb->fd = pdes[0]; scb->error_fd = err_pdes[0]; diff --git a/gdb/serial.c b/gdb/serial.c index 99e33ab..c87875f 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -211,7 +211,7 @@ serial_open (const char *name) if (!ops) return NULL; - scb = XMALLOC (struct serial); + scb = XNEW (struct serial); scb->ops = ops; diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 547f139..262de84 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -2370,7 +2370,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) /* None found, create a new architecture from the information provided. */ - tdep = XMALLOC (struct gdbarch_tdep); + tdep = XNEW (struct gdbarch_tdep); gdbarch = gdbarch_alloc (&info, tdep); /* Determine the ABI */ diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index 1ceb80f..4deb006 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -447,7 +447,7 @@ tui_alloc_generic_win_info (void) { struct tui_gen_win_info *win; - if ((win = XMALLOC (struct tui_gen_win_info)) != NULL) + if ((win = XNEW (struct tui_gen_win_info)) != NULL) tui_init_generic_part (win); return win; @@ -570,7 +570,7 @@ tui_alloc_win_info (enum tui_win_type type) { struct tui_win_info *win_info; - win_info = XMALLOC (struct tui_win_info); + win_info = XNEW (struct tui_win_info); if (win_info != NULL) { win_info->generic.type = type; @@ -647,7 +647,7 @@ tui_add_content_elements (struct tui_gen_win_info *win_info, { for (i = index_start; (i < num_elements + index_start); i++) { - if ((element_ptr = XMALLOC (struct tui_win_element)) != NULL) + if ((element_ptr = XNEW (struct tui_win_element)) != NULL) { win_info->content[i] = (void *) element_ptr; init_content_element (element_ptr, win_info->type); diff --git a/gdb/tui/tui-file.c b/gdb/tui/tui-file.c index c86e260..8e84fc5 100644 --- a/gdb/tui/tui-file.c +++ b/gdb/tui/tui-file.c @@ -57,7 +57,7 @@ static int tui_file_magic; static struct ui_file * tui_file_new (void) { - struct tui_stream *tui = XMALLOC (struct tui_stream); + struct tui_stream *tui = XNEW (struct tui_stream); struct ui_file *file = ui_file_new (); set_ui_file_data (file, tui, tui_file_delete); diff --git a/gdb/tui/tui-out.c b/gdb/tui/tui-out.c index 9e89419..44f76a2 100644 --- a/gdb/tui/tui-out.c +++ b/gdb/tui/tui-out.c @@ -150,7 +150,7 @@ tui_out_new (struct ui_file *stream) { int flags = 0; - tui_out_data *data = XMALLOC (tui_out_data); + tui_out_data *data = XNEW (tui_out_data); /* Initialize base "class". */ cli_out_data_ctor (&data->base, stream); diff --git a/gdb/ui-file.c b/gdb/ui-file.c index 4de5785..e59d70b 100644 --- a/gdb/ui-file.c +++ b/gdb/ui-file.c @@ -393,7 +393,7 @@ static int mem_file_magic; static struct ui_file * mem_file_new (void) { - struct mem_file *stream = XMALLOC (struct mem_file); + struct mem_file *stream = XNEW (struct mem_file); struct ui_file *file = ui_file_new (); set_ui_file_data (file, stream, mem_file_delete); diff --git a/gdb/ui-out.c b/gdb/ui-out.c index d0dc2f4..a591352 100644 --- a/gdb/ui-out.c +++ b/gdb/ui-out.c @@ -131,7 +131,7 @@ push_level (struct ui_out *uiout, struct ui_out_level *current; uiout->level++; - current = XMALLOC (struct ui_out_level); + current = XNEW (struct ui_out_level); current->field_count = 0; current->type = type; VEC_safe_push (ui_out_level_p, uiout->levels, current); @@ -443,7 +443,7 @@ make_cleanup_ui_out_end (struct ui_out *uiout, { struct ui_out_end_cleanup_data *end_cleanup_data; - end_cleanup_data = XMALLOC (struct ui_out_end_cleanup_data); + end_cleanup_data = XNEW (struct ui_out_end_cleanup_data); end_cleanup_data->uiout = uiout; end_cleanup_data->type = type; return make_cleanup (do_cleanup_end, end_cleanup_data); @@ -964,7 +964,7 @@ append_header_to_list (struct ui_out *uiout, { struct ui_out_hdr *temphdr; - temphdr = XMALLOC (struct ui_out_hdr); + temphdr = XNEW (struct ui_out_hdr); temphdr->width = width; temphdr->alignment = alignment; /* We have to copy the column title as the original may be an @@ -1098,8 +1098,8 @@ struct ui_out * ui_out_new (struct ui_out_impl *impl, void *data, int flags) { - struct ui_out *uiout = XMALLOC (struct ui_out); - struct ui_out_level *current = XMALLOC (struct ui_out_level); + struct ui_out *uiout = XNEW (struct ui_out); + struct ui_out_level *current = XNEW (struct ui_out_level); uiout->data = data; uiout->impl = impl; diff --git a/gdb/user-regs.c b/gdb/user-regs.c index 480c968..db0cac8 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -85,7 +85,7 @@ user_reg_add_builtin (const char *name, user_reg_read_ftype *read, const void *baton) { append_user_reg (&builtin_user_regs, name, read, baton, - XMALLOC (struct user_reg)); + XNEW (struct user_reg)); } /* Per-architecture user registers. Start with the builtin user |