This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH 1/3] replace XZALLOC with XCNEW
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Cc: Tom Tromey <tromey at redhat dot com>
- Date: Mon, 6 Jan 2014 10:32:02 -0700
- Subject: [PATCH 1/3] replace XZALLOC with XCNEW
- Authentication-results: sourceware.org; auth=none
- References: <1389029524-19907-1-git-send-email-tromey at redhat dot com>
This replaces XZALLOC with XCNEW and removes XZALLOC.
This change is purely mechanical.
2014-01-06 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.
(get_ada_tasks_inferior_data): Likewise.
* auto-load.c (get_auto_load_pspace_data): Likewise.
* auxv.c (get_auxv_inferior_data): Likewise.
* bfd-target.c (target_bfd_reopen): Likewise.
* breakpoint.c (get_catch_syscall_inferior_data): Likewise.
(deprecated_insert_raw_breakpoint): Likewise.
* bsd-uthread.c (bsd_uthread_pid_to_str): Likewise.
* corelow.c (core_open): Likewise.
* darwin-nat.c (darwin_check_new_threads): Likewise.
(darwin_attach_pid): Likewise.
* dummy-frame.c (dummy_frame_push): Likewise.
* dwarf2-frame.c (dwarf2_frame_cache): Likewise.
* dwarf2loc.c (allocate_piece_closure): Likewise.
* elfread.c (elf_symfile_segments): Likewise.
* eval.c (ptrmath_type_p): Likewise.
* exceptions.c (EXCEPTIONS_SIGJMP_BUF): Likewise.
* gdbtypes.c (alloc_type_arch): Likewise.
(alloc_type_instance): Likewise.
* hppa-tdep.c (hppa_gdbarch_init): Likewise.
* inf-child.c (inf_child_can_use_agent): Likewise.
* inflow.c (get_inflow_inferior_data): Likewise.
* infrun.c (save_infcall_suspend_state): Likewise.
* jit.c (jit_reader_load): Likewise.
(get_jit_objfile_data): Likewise.
(get_jit_program_space_data): Likewise.
(jit_object_open_impl): Likewise.
(jit_symtab_open_impl): Likewise.
(jit_block_open_impl): Likewise.
(jit_frame_sniffer): Likewise.
* linux-fork.c (add_fork): Likewise.
* maint.c (make_command_stats_cleanup): Likewise.
* objfiles.c (get_objfile_pspace_data): Likewise.
* opencl-lang.c (struct lval_closure): Likewise.
* osdata.c (osdata_start_osdata): Likewise.
* progspace.c (new_address_space): Likewise.
(add_program_space): Likewise.
* remote-sim.c (get_sim_inferior_data): Likewise.
* sh-tdep.c (sh_gdbarch_init): Likewise.
* skip.c (Ignore): Likewise.
(skip_delete_command): Likewise.
* solib-aix.c (get_solib_aix_inferior_data): Likewise.
(library_list_start_library): Likewise.
(solib_aix_current_sos): Likewise.
* solib-darwin.c (get_darwin_info): Likewise.
(darwin_current_sos): Likewise.
* solib-dsbt.c (get_dsbt_info): Likewise.
* solib-ia64-hpux.c (new_so_list): Likewise.
(ia64_hpux_get_solib_linkage_addr): Likewise.
* solib-spu.c (append_ocl_sos): Likewise.
(spu_current_sos): Likewise.
* solib-svr4.c (get_svr4_info): Likewise.
(svr4_keep_data_in_core): Likewise.
(library_list_start_library): Likewise.
(svr4_default_sos): Likewise.
(svr4_read_so_list): Likewise.
* solib-target.c (library_list_start_library): Likewise.
(solib_target_current_sos): Likewise.
* sparc-tdep.c (sparc32_gdbarch_init): Likewise.
* symfile-debug.c (install_symfile_debug_logging): Likewise.
* symfile.c (default_symfile_segments): Likewise.
* target-descriptions.c (tdesc_data_init): Likewise.
(tdesc_create_reg): Likewise.
(struct tdesc_type *): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_set_struct_size): Likewise.
(struct tdesc_type *): Likewise.
(tdesc_free_feature): Likewise.
(tdesc_create_feature): Likewise.
* windows-nat.c (windows_add_thread): Likewise.
(windows_make_so): Likewise.
* xml-support.c (gdb_xml_body_text): Likewise.
(gdb_xml_create_parser_and_cleanup): Likewise.
(xml_process_xincludes): Likewise.
* xml-syscall.c (allocate_syscalls_info): Likewise.
(syscall_create_syscall_desc): Likewise.
---
gdb/ChangeLog | 81 +++++++++++++++++++++++++++++++++++++++++++++++
gdb/ada-lang.c | 2 +-
gdb/ada-tasks.c | 4 +--
gdb/auto-load.c | 2 +-
gdb/auxv.c | 2 +-
gdb/bfd-target.c | 4 +--
gdb/breakpoint.c | 4 +--
gdb/bsd-uthread.c | 2 +-
gdb/corelow.c | 2 +-
gdb/darwin-nat.c | 4 +--
gdb/defs.h | 1 -
gdb/dummy-frame.c | 2 +-
gdb/dwarf2-frame.c | 2 +-
gdb/dwarf2loc.c | 2 +-
gdb/elfread.c | 2 +-
gdb/eval.c | 4 +--
gdb/exceptions.c | 2 +-
gdb/gdbtypes.c | 6 ++--
gdb/hppa-tdep.c | 2 +-
gdb/inf-child.c | 2 +-
gdb/inflow.c | 2 +-
gdb/infrun.c | 2 +-
gdb/jit.c | 14 ++++----
gdb/linux-fork.c | 2 +-
gdb/maint.c | 2 +-
gdb/objfiles.c | 2 +-
gdb/opencl-lang.c | 2 +-
gdb/osdata.c | 2 +-
gdb/progspace.c | 4 +--
gdb/remote-sim.c | 2 +-
gdb/sh-tdep.c | 2 +-
gdb/skip.c | 4 +--
gdb/solib-aix.c | 6 ++--
gdb/solib-darwin.c | 4 +--
gdb/solib-dsbt.c | 2 +-
gdb/solib-ia64-hpux.c | 6 ++--
gdb/solib-spu.c | 4 +--
gdb/solib-svr4.c | 12 +++----
gdb/solib-target.c | 4 +--
gdb/sparc-tdep.c | 2 +-
gdb/symfile-debug.c | 2 +-
gdb/symfile.c | 2 +-
gdb/target-descriptions.c | 16 +++++-----
gdb/windows-nat.c | 4 +--
gdb/xml-support.c | 6 ++--
gdb/xml-syscall.c | 4 +--
46 files changed, 163 insertions(+), 83 deletions(-)
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index c14b684..15f95b4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -359,7 +359,7 @@ get_ada_inferior_data (struct inferior *inf)
data = inferior_data (inf, ada_inferior_data);
if (data == NULL)
{
- data = XZALLOC (struct ada_inferior_data);
+ data = XCNEW (struct ada_inferior_data);
set_inferior_data (inf, ada_inferior_data, data);
}
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 53a29e1..a83035f 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -251,7 +251,7 @@ get_ada_tasks_pspace_data (struct program_space *pspace)
data = program_space_data (pspace, ada_tasks_pspace_data_handle);
if (data == NULL)
{
- data = XZALLOC (struct ada_tasks_pspace_data);
+ data = XCNEW (struct ada_tasks_pspace_data);
set_program_space_data (pspace, ada_tasks_pspace_data_handle, data);
}
@@ -278,7 +278,7 @@ get_ada_tasks_inferior_data (struct inferior *inf)
data = inferior_data (inf, ada_tasks_inferior_data_handle);
if (data == NULL)
{
- data = XZALLOC (struct ada_tasks_inferior_data);
+ data = XCNEW (struct ada_tasks_inferior_data);
set_inferior_data (inf, ada_tasks_inferior_data_handle, data);
}
diff --git a/gdb/auto-load.c b/gdb/auto-load.c
index 4bb4ced..1618e13 100644
--- a/gdb/auto-load.c
+++ b/gdb/auto-load.c
@@ -596,7 +596,7 @@ get_auto_load_pspace_data (struct program_space *pspace)
info = program_space_data (pspace, auto_load_pspace_data);
if (info == NULL)
{
- info = XZALLOC (struct auto_load_pspace_info);
+ info = XCNEW (struct auto_load_pspace_info);
set_program_space_data (pspace, auto_load_pspace_data, info);
}
diff --git a/gdb/auxv.c b/gdb/auxv.c
index b08f1d5..6223de2 100644
--- a/gdb/auxv.c
+++ b/gdb/auxv.c
@@ -341,7 +341,7 @@ get_auxv_inferior_data (struct target_ops *ops)
info = inferior_data (inf, auxv_inferior_data);
if (info == NULL)
{
- info = XZALLOC (struct auxv_info);
+ info = XCNEW (struct auxv_info);
info->length = target_read_alloc (ops, TARGET_OBJECT_AUXV,
NULL, &info->data);
set_inferior_data (inf, auxv_inferior_data, info);
diff --git a/gdb/bfd-target.c b/gdb/bfd-target.c
index 4cbac20..559ca63 100644
--- a/gdb/bfd-target.c
+++ b/gdb/bfd-target.c
@@ -83,12 +83,12 @@ target_bfd_reopen (struct bfd *abfd)
struct target_ops *t;
struct target_bfd_data *data;
- data = XZALLOC (struct target_bfd_data);
+ data = XCNEW (struct target_bfd_data);
data->bfd = abfd;
gdb_bfd_ref (abfd);
build_section_table (abfd, &data->table.sections, &data->table.sections_end);
- t = XZALLOC (struct target_ops);
+ t = XCNEW (struct target_ops);
t->to_shortname = "bfd";
t->to_longname = _("BFD backed target");
t->to_doc = _("You should never see this");
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 114762d..e65f85e 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8190,7 +8190,7 @@ get_catch_syscall_inferior_data (struct inferior *inf)
inf_data = inferior_data (inf, catch_syscall_inferior_data);
if (inf_data == NULL)
{
- inf_data = XZALLOC (struct catch_syscall_inferior_data);
+ inf_data = XCNEW (struct catch_syscall_inferior_data);
set_inferior_data (inf, catch_syscall_inferior_data, inf_data);
}
@@ -14946,7 +14946,7 @@ deprecated_insert_raw_breakpoint (struct gdbarch *gdbarch,
{
struct bp_target_info *bp_tgt;
- bp_tgt = XZALLOC (struct bp_target_info);
+ bp_tgt = XCNEW (struct bp_target_info);
bp_tgt->placed_address_space = aspace;
bp_tgt->placed_address = pc;
diff --git a/gdb/bsd-uthread.c b/gdb/bsd-uthread.c
index 5757e77..af522fa 100644
--- a/gdb/bsd-uthread.c
+++ b/gdb/bsd-uthread.c
@@ -518,7 +518,7 @@ bsd_uthread_pid_to_str (struct target_ops *ops, ptid_t ptid)
static struct target_ops *
bsd_uthread_target (void)
{
- struct target_ops *t = XZALLOC (struct target_ops);
+ struct target_ops *t = XCNEW (struct target_ops);
t->to_shortname = "bsd-uthreads";
t->to_longname = "BSD user-level threads";
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 7183f62..8b20d3f 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -348,7 +348,7 @@ core_open (char *filename, int from_tty)
validate_files ();
- core_data = XZALLOC (struct target_section_table);
+ core_data = XCNEW (struct target_section_table);
/* Find the data section */
if (build_section_table (core_bfd,
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index a21bb0f..f0935a6 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -350,7 +350,7 @@ darwin_check_new_threads (struct inferior *inf)
struct thread_info *tp;
struct private_thread_info *pti;
- pti = XZALLOC (struct private_thread_info);
+ pti = XCNEW (struct private_thread_info);
pti->gdb_port = new_id;
pti->msg_state = DARWIN_RUNNING;
@@ -1344,7 +1344,7 @@ darwin_attach_pid (struct inferior *inf)
mach_port_t prev_not;
exception_mask_t mask;
- inf->private = XZALLOC (darwin_inferior);
+ inf->private = XCNEW (darwin_inferior);
kret = task_for_pid (gdb_task, inf->pid, &inf->private->task);
if (kret != KERN_SUCCESS)
diff --git a/gdb/defs.h b/gdb/defs.h
index f3f034f..4c70cf6 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -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 XZALLOC(TYPE) ((TYPE*) xzalloc (sizeof (TYPE)))
#define XMALLOC(TYPE) ((TYPE*) xmalloc (sizeof (TYPE)))
#define XCALLOC(NMEMB, TYPE) ((TYPE*) xcalloc ((NMEMB), sizeof (TYPE)))
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 390b4c9..998ca93 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -56,7 +56,7 @@ dummy_frame_push (struct infcall_suspend_state *caller_state,
{
struct dummy_frame *dummy_frame;
- dummy_frame = XZALLOC (struct dummy_frame);
+ dummy_frame = XCNEW (struct dummy_frame);
dummy_frame->caller_state = caller_state;
dummy_frame->id = (*dummy_id);
dummy_frame->next = dummy_frame_stack;
diff --git a/gdb/dwarf2-frame.c b/gdb/dwarf2-frame.c
index 1907128..3dcaf27 100644
--- a/gdb/dwarf2-frame.c
+++ b/gdb/dwarf2-frame.c
@@ -1045,7 +1045,7 @@ dwarf2_frame_cache (struct frame_info *this_frame, void **this_cache)
reset_cache_cleanup = make_cleanup (clear_pointer_cleanup, this_cache);
/* Allocate and initialize the frame state. */
- fs = XZALLOC (struct dwarf2_frame_state);
+ fs = XCNEW (struct dwarf2_frame_state);
old_chain = make_cleanup (dwarf2_frame_state_free, fs);
/* Unwind the PC.
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index dd921ec..6185a6b 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -1414,7 +1414,7 @@ allocate_piece_closure (struct dwarf2_per_cu_data *per_cu,
int n_pieces, struct dwarf_expr_piece *pieces,
int addr_size)
{
- struct piece_closure *c = XZALLOC (struct piece_closure);
+ struct piece_closure *c = XCNEW (struct piece_closure);
int i;
c->refc = 1;
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 31f6470..4f27aff 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -105,7 +105,7 @@ elf_symfile_segments (bfd *abfd)
if (num_segments == 0)
return NULL;
- data = XZALLOC (struct symfile_segment_data);
+ 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);
diff --git a/gdb/eval.c b/gdb/eval.c
index bfbe319..949f76c 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -660,8 +660,8 @@ ptrmath_type_p (const struct language_defn *lang, struct type *type)
static struct type *
make_params (int num_types, struct type **param_types)
{
- struct type *type = XZALLOC (struct type);
- TYPE_MAIN_TYPE (type) = XZALLOC (struct main_type);
+ struct type *type = XCNEW (struct type);
+ TYPE_MAIN_TYPE (type) = XCNEW (struct main_type);
TYPE_LENGTH (type) = 1;
TYPE_CODE (type) = TYPE_CODE_METHOD;
TYPE_VPTR_FIELDNO (type) = -1;
diff --git a/gdb/exceptions.c b/gdb/exceptions.c
index b0b6c97..ca80893 100644
--- a/gdb/exceptions.c
+++ b/gdb/exceptions.c
@@ -86,7 +86,7 @@ EXCEPTIONS_SIGJMP_BUF *
exceptions_state_mc_init (volatile struct gdb_exception *exception,
return_mask mask)
{
- struct catcher *new_catcher = XZALLOC (struct catcher);
+ struct catcher *new_catcher = XCNEW (struct catcher);
/* Start with no exception, save it's address. */
exception->reason = 0;
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 8e3090d..e02b66c 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -201,8 +201,8 @@ alloc_type_arch (struct gdbarch *gdbarch)
/* Alloc the structure and start off with all fields zeroed. */
- type = XZALLOC (struct type);
- TYPE_MAIN_TYPE (type) = XZALLOC (struct main_type);
+ type = XCNEW (struct type);
+ TYPE_MAIN_TYPE (type) = XCNEW (struct main_type);
TYPE_OBJFILE_OWNED (type) = 0;
TYPE_OWNER (type).gdbarch = gdbarch;
@@ -268,7 +268,7 @@ alloc_type_instance (struct type *oldtype)
/* Allocate the structure. */
if (! TYPE_OBJFILE_OWNED (oldtype))
- type = XZALLOC (struct type);
+ type = XCNEW (struct type);
else
type = OBSTACK_ZALLOC (&TYPE_OBJFILE (oldtype)->objfile_obstack,
struct type);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 68ec9cf..53b6c95 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2997,7 +2997,7 @@ hppa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return (arches->gdbarch);
/* If none found, then allocate and initialize one. */
- tdep = XZALLOC (struct gdbarch_tdep);
+ tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
/* Determine from the bfd_arch_info structure if we are dealing with
diff --git a/gdb/inf-child.c b/gdb/inf-child.c
index d722509..75944a0 100644
--- a/gdb/inf-child.c
+++ b/gdb/inf-child.c
@@ -386,7 +386,7 @@ inf_child_can_use_agent (void)
struct target_ops *
inf_child_target (void)
{
- struct target_ops *t = XZALLOC (struct target_ops);
+ struct target_ops *t = XCNEW (struct target_ops);
t->to_shortname = "child";
t->to_longname = "Unix child process";
diff --git a/gdb/inflow.c b/gdb/inflow.c
index 9e2444c..5503a42 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -505,7 +505,7 @@ get_inflow_inferior_data (struct inferior *inf)
info = inferior_data (inf, inflow_inferior_data);
if (info == NULL)
{
- info = XZALLOC (struct terminal_info);
+ info = XCNEW (struct terminal_info);
set_inferior_data (inf, inflow_inferior_data, info);
}
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 51540b3..73038a3 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -6851,7 +6851,7 @@ save_infcall_suspend_state (void)
}
}
- inf_state = XZALLOC (struct infcall_suspend_state);
+ inf_state = XCNEW (struct infcall_suspend_state);
if (siginfo_data)
{
diff --git a/gdb/jit.c b/gdb/jit.c
index 033a370..59823a5 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -189,7 +189,7 @@ jit_reader_load (const char *file_name)
if (funcs->reader_version != GDB_READER_INTERFACE_VERSION)
error (_("Reader version does not match GDB version."));
- new_reader = XZALLOC (struct jit_reader);
+ new_reader = XCNEW (struct jit_reader);
new_reader->functions = funcs;
new_reader->handle = so;
@@ -288,7 +288,7 @@ get_jit_objfile_data (struct objfile *objf)
objf_data = objfile_data (objf, jit_objfile_data);
if (objf_data == NULL)
{
- objf_data = XZALLOC (struct jit_objfile_data);
+ objf_data = XCNEW (struct jit_objfile_data);
set_objfile_data (objf, jit_objfile_data, objf_data);
}
@@ -318,7 +318,7 @@ get_jit_program_space_data (void)
ps_data = program_space_data (current_program_space, jit_program_space_data);
if (ps_data == NULL)
{
- ps_data = XZALLOC (struct jit_program_space_data);
+ ps_data = XCNEW (struct jit_program_space_data);
set_program_space_data (current_program_space, jit_program_space_data,
ps_data);
}
@@ -504,7 +504,7 @@ jit_object_open_impl (struct gdb_symbol_callbacks *cb)
/* CB is not required right now, but sometime in the future we might
need a handle to it, and we'd like to do that without breaking
the ABI. */
- return XZALLOC (struct gdb_object);
+ return XCNEW (struct gdb_object);
}
/* Readers call into this function to open a new gdb_symtab, which,
@@ -519,7 +519,7 @@ jit_symtab_open_impl (struct gdb_symbol_callbacks *cb,
/* CB stays unused. See comment in jit_object_open_impl. */
- ret = XZALLOC (struct gdb_symtab);
+ ret = XCNEW (struct gdb_symtab);
ret->file_name = file_name ? xstrdup (file_name) : xstrdup ("");
ret->next = object->symtabs;
object->symtabs = ret;
@@ -557,7 +557,7 @@ jit_block_open_impl (struct gdb_symbol_callbacks *cb,
struct gdb_symtab *symtab, struct gdb_block *parent,
GDB_CORE_ADDR begin, GDB_CORE_ADDR end, const char *name)
{
- struct gdb_block *block = XZALLOC (struct gdb_block);
+ struct gdb_block *block = XCNEW (struct gdb_block);
block->next = symtab->blocks;
block->begin = (CORE_ADDR) begin;
@@ -1181,7 +1181,7 @@ jit_frame_sniffer (const struct frame_unwind *self,
gdb_assert (!*cache);
- *cache = XZALLOC (struct jit_unwind_private);
+ *cache = XCNEW (struct jit_unwind_private);
priv_data = *cache;
priv_data->registers =
XCALLOC (gdbarch_num_regs (get_frame_arch (this_frame)),
diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index f8afd4a..cfe1ce5 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -81,7 +81,7 @@ add_fork (pid_t pid)
add_fork (ptid_get_pid (inferior_ptid)); /* safe recursion */
}
- fp = XZALLOC (struct fork_info);
+ fp = XCNEW (struct fork_info);
fp->ptid = ptid_build (pid, pid, 0);
fp->num = ++highest_fork_num;
fp->next = fork_list;
diff --git a/gdb/maint.c b/gdb/maint.c
index df8a8fe..41a39e7 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -902,7 +902,7 @@ make_command_stats_cleanup (int msg_type)
&& !per_command_symtab)
return make_cleanup (null_cleanup, 0);
- new_stat = XZALLOC (struct cmd_stats);
+ new_stat = XCNEW (struct cmd_stats);
new_stat->msg_type = msg_type;
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 73847bd..9cc0054 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -102,7 +102,7 @@ get_objfile_pspace_data (struct program_space *pspace)
info = program_space_data (pspace, objfiles_pspace_data);
if (info == NULL)
{
- info = XZALLOC (struct objfile_pspace_info);
+ info = XCNEW (struct objfile_pspace_info);
set_program_space_data (pspace, objfiles_pspace_data, info);
}
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index f098b3f..4327fe6 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -157,7 +157,7 @@ struct lval_closure
static struct lval_closure *
allocate_lval_closure (int *indices, int n, struct value *val)
{
- struct lval_closure *c = XZALLOC (struct lval_closure);
+ struct lval_closure *c = XCNEW (struct lval_closure);
c->refc = 1;
c->n = n;
diff --git a/gdb/osdata.c b/gdb/osdata.c
index 467e2f1..da9bfac 100644
--- a/gdb/osdata.c
+++ b/gdb/osdata.c
@@ -69,7 +69,7 @@ osdata_start_osdata (struct gdb_xml_parser *parser,
gdb_xml_error (parser, _("Seen more than on osdata element"));
type = xml_find_attribute (attributes, "type")->value;
- osdata = XZALLOC (struct osdata);
+ osdata = XCNEW (struct osdata);
osdata->type = xstrdup (type);
data->osdata = osdata;
}
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 9a6321f..14507ef 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -70,7 +70,7 @@ new_address_space (void)
{
struct address_space *aspace;
- aspace = XZALLOC (struct address_space);
+ aspace = XCNEW (struct address_space);
aspace->num = ++highest_address_space_num;
address_space_alloc_data (aspace);
@@ -126,7 +126,7 @@ add_program_space (struct address_space *aspace)
{
struct program_space *pspace;
- pspace = XZALLOC (struct program_space);
+ pspace = XCNEW (struct program_space);
pspace->num = ++last_program_space_num;
pspace->aspace = aspace;
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index b0f4922..7263727 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -206,7 +206,7 @@ get_sim_inferior_data (struct inferior *inf, int sim_instance_needed)
if (sim_data == NULL)
{
- sim_data = XZALLOC(struct sim_inferior_data);
+ sim_data = XCNEW(struct sim_inferior_data);
set_inferior_data (inf, sim_inferior_data_key, sim_data);
/* Allocate a ptid for this inferior. */
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 6bfd041..85f8067 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -2253,7 +2253,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
/* None found, create a new architecture from the information
provided. */
- tdep = XZALLOC (struct gdbarch_tdep);
+ tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
diff --git a/gdb/skip.c b/gdb/skip.c
index 5aadb73..64a0254 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -101,7 +101,7 @@ Ignore file pending future shared library load? ")))
filename = arg;
}
- e = XZALLOC (struct skiplist_entry);
+ e = XCNEW (struct skiplist_entry);
e->filename = xstrdup (filename);
e->enabled = 1;
@@ -295,7 +295,7 @@ skip_delete_command (char *arg, int from_tty)
static void
skip_function (const char *name)
{
- struct skiplist_entry *e = XZALLOC (struct skiplist_entry);
+ struct skiplist_entry *e = XCNEW (struct skiplist_entry);
e->enabled = 1;
e->function_name = xstrdup (name);
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index fefa51f..8f335f6 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -115,7 +115,7 @@ get_solib_aix_inferior_data (struct inferior *inf)
data = inferior_data (inf, solib_aix_inferior_data_handle);
if (data == NULL)
{
- data = XZALLOC (struct solib_aix_inferior_data);
+ data = XCNEW (struct solib_aix_inferior_data);
set_inferior_data (inf, solib_aix_inferior_data_handle, data);
}
@@ -161,7 +161,7 @@ library_list_start_library (struct gdb_xml_parser *parser,
VEC (gdb_xml_value_s) *attributes)
{
VEC (lm_info_p) **list = user_data;
- struct lm_info *item = XZALLOC (struct lm_info);
+ struct lm_info *item = XCNEW (struct lm_info);
struct gdb_xml_value *attr;
attr = xml_find_attribute (attributes, "name");
@@ -575,7 +575,7 @@ solib_aix_current_sos (void)
to the main executable, not a shared library. */
for (ix = 1; VEC_iterate (lm_info_p, library_list, ix, info); ix++)
{
- struct so_list *new_solib = XZALLOC (struct so_list);
+ struct so_list *new_solib = XCNEW (struct so_list);
char *so_name;
if (info->member_name == NULL)
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c
index ba807a2..e8d4667 100644
--- a/gdb/solib-darwin.c
+++ b/gdb/solib-darwin.c
@@ -103,7 +103,7 @@ get_darwin_info (void)
if (info != NULL)
return info;
- info = XZALLOC (struct darwin_info);
+ info = XCNEW (struct darwin_info);
set_program_space_data (current_program_space,
solib_darwin_pspace_data, info);
return info;
@@ -304,7 +304,7 @@ darwin_current_sos (void)
break;
/* Create and fill the new so_list element. */
- dnew = XZALLOC (struct darwin_so_list);
+ dnew = XCNEW (struct darwin_so_list);
new = &dnew->sl;
old_chain = make_cleanup (xfree, dnew);
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 075c92e..713fa51 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -181,7 +181,7 @@ get_dsbt_info (void)
if (info != NULL)
return info;
- info = XZALLOC (struct dsbt_info);
+ info = XCNEW (struct dsbt_info);
set_program_space_data (current_program_space, solib_dsbt_pspace_data, info);
info->lm_base_cache = 0;
diff --git a/gdb/solib-ia64-hpux.c b/gdb/solib-ia64-hpux.c
index d91b2a1..b53caa8 100644
--- a/gdb/solib-ia64-hpux.c
+++ b/gdb/solib-ia64-hpux.c
@@ -86,8 +86,8 @@ new_so_list (char *so_name, struct load_module_desc module_desc)
{
struct so_list *new_so;
- new_so = (struct so_list *) XZALLOC (struct so_list);
- new_so->lm_info = (struct lm_info *) XZALLOC (struct lm_info);
+ new_so = (struct so_list *) XCNEW (struct so_list);
+ new_so->lm_info = (struct lm_info *) XCNEW (struct lm_info);
new_so->lm_info->module_desc = module_desc;
strncpy (new_so->so_name, so_name, SO_NAME_MAX_PATH_SIZE - 1);
@@ -677,7 +677,7 @@ ia64_hpux_get_solib_linkage_addr (CORE_ADDR faddr)
static struct target_so_ops *
ia64_hpux_target_so_ops (void)
{
- struct target_so_ops *ops = XZALLOC (struct target_so_ops);
+ struct target_so_ops *ops = XCNEW (struct target_so_ops);
ops->relocate_section_addresses = ia64_hpux_relocate_section_addresses;
ops->free_so = ia64_hpux_free_so;
diff --git a/gdb/solib-spu.c b/gdb/solib-spu.c
index abb8c15..b8e5e23 100644
--- a/gdb/solib-spu.c
+++ b/gdb/solib-spu.c
@@ -125,7 +125,7 @@ append_ocl_sos (struct so_list **link_ptr)
struct so_list *new;
/* Allocate so_list structure. */
- new = XZALLOC (struct so_list);
+ new = XCNEW (struct so_list);
/* Encode FD and object ID in path name. */
xsnprintf (new->so_name, sizeof new->so_name, "@%s <%d>",
@@ -217,7 +217,7 @@ spu_current_sos (void)
continue;
/* Allocate so_list structure. */
- new = XZALLOC (struct so_list);
+ new = XCNEW (struct so_list);
/* Encode FD and object ID in path name. Choose the name so as not
to conflict with any (normal) SVR4 library path name. */
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index cf9d651..55572d4 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -427,7 +427,7 @@ get_svr4_info (void)
if (info != NULL)
return info;
- info = XZALLOC (struct svr4_info);
+ info = XCNEW (struct svr4_info);
set_program_space_data (current_program_space, solib_svr4_pspace_data, info);
return info;
}
@@ -949,7 +949,7 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
if (!ldsomap)
return 0;
- new = XZALLOC (struct so_list);
+ new = XCNEW (struct so_list);
old_chain = make_cleanup (xfree, new);
new->lm_info = lm_info_read (ldsomap);
make_cleanup (xfree, new->lm_info);
@@ -1126,8 +1126,8 @@ library_list_start_library (struct gdb_xml_parser *parser,
ULONGEST *l_ldp = xml_find_attribute (attributes, "l_ld")->value;
struct so_list *new_elem;
- new_elem = XZALLOC (struct so_list);
- new_elem->lm_info = XZALLOC (struct lm_info);
+ new_elem = XCNEW (struct so_list);
+ new_elem->lm_info = XCNEW (struct lm_info);
new_elem->lm_info->lm_addr = *lmp;
new_elem->lm_info->l_addr_inferior = *l_addrp;
new_elem->lm_info->l_ld = *l_ldp;
@@ -1279,7 +1279,7 @@ svr4_default_sos (void)
if (!info->debug_loader_offset_p)
return NULL;
- new = XZALLOC (struct so_list);
+ new = XCNEW (struct so_list);
new->lm_info = xzalloc (sizeof (struct lm_info));
@@ -1316,7 +1316,7 @@ svr4_read_so_list (CORE_ADDR lm, CORE_ADDR prev_lm,
int errcode;
char *buffer;
- new = XZALLOC (struct so_list);
+ new = XCNEW (struct so_list);
old_chain = make_cleanup_free_so (new);
new->lm_info = lm_info_read (lm);
diff --git a/gdb/solib-target.c b/gdb/solib-target.c
index fb12934..bb34e4b 100644
--- a/gdb/solib-target.c
+++ b/gdb/solib-target.c
@@ -119,7 +119,7 @@ library_list_start_library (struct gdb_xml_parser *parser,
void *user_data, VEC(gdb_xml_value_s) *attributes)
{
VEC(lm_info_p) **list = user_data;
- struct lm_info *item = XZALLOC (struct lm_info);
+ struct lm_info *item = XCNEW (struct lm_info);
const char *name = xml_find_attribute (attributes, "name")->value;
item->name = xstrdup (name);
@@ -274,7 +274,7 @@ solib_target_current_sos (void)
/* Build a struct so_list for each entry on the list. */
for (ix = 0; VEC_iterate (lm_info_p, library_list, ix, info); ix++)
{
- new_solib = XZALLOC (struct so_list);
+ new_solib = XCNEW (struct so_list);
strncpy (new_solib->so_name, info->name, SO_NAME_MAX_PATH_SIZE - 1);
new_solib->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
strncpy (new_solib->so_original_name, info->name,
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 66ef84e..38b345b 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -1653,7 +1653,7 @@ sparc32_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
return arches->gdbarch;
/* Allocate space for the new architecture. */
- tdep = XZALLOC (struct gdbarch_tdep);
+ tdep = XCNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
tdep->pc_regnum = SPARC32_PC_REGNUM;
diff --git a/gdb/symfile-debug.c b/gdb/symfile-debug.c
index 57d4af0..705d9cb 100644
--- a/gdb/symfile-debug.c
+++ b/gdb/symfile-debug.c
@@ -575,7 +575,7 @@ install_symfile_debug_logging (struct objfile *objfile)
real_sf = objfile->sf;
/* Alas we have to preserve NULL entries in REAL_SF. */
- debug_data = XZALLOC (struct debug_sym_fns_data);
+ debug_data = XCNEW (struct debug_sym_fns_data);
#define COPY_SF_PTR(from, to, name, func) \
do { \
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 4f0fea8..75e71cb 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -800,7 +800,7 @@ default_symfile_segments (bfd *abfd)
low = bfd_get_section_vma (abfd, sect);
high = low + bfd_get_section_size (sect);
- data = XZALLOC (struct symfile_segment_data);
+ data = XCNEW (struct symfile_segment_data);
data->num_segments = 1;
data->segment_bases = XCALLOC (1, CORE_ADDR);
data->segment_sizes = XCALLOC (1, CORE_ADDR);
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 9147dbe..953748b 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -804,7 +804,7 @@ tdesc_data_init (struct obstack *obstack)
struct tdesc_arch_data *
tdesc_data_alloc (void)
{
- return XZALLOC (struct tdesc_arch_data);
+ return XCNEW (struct tdesc_arch_data);
}
/* Free something allocated by tdesc_data_alloc, if it is not going
@@ -1242,7 +1242,7 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name,
int regnum, int save_restore, const char *group,
int bitsize, const char *type)
{
- struct tdesc_reg *reg = XZALLOC (struct tdesc_reg);
+ struct tdesc_reg *reg = XCNEW (struct tdesc_reg);
reg->name = xstrdup (name);
reg->target_regnum = regnum;
@@ -1304,7 +1304,7 @@ struct tdesc_type *
tdesc_create_vector (struct tdesc_feature *feature, const char *name,
struct tdesc_type *field_type, int count)
{
- struct tdesc_type *type = XZALLOC (struct tdesc_type);
+ struct tdesc_type *type = XCNEW (struct tdesc_type);
type->name = xstrdup (name);
type->kind = TDESC_TYPE_VECTOR;
@@ -1318,7 +1318,7 @@ tdesc_create_vector (struct tdesc_feature *feature, const char *name,
struct tdesc_type *
tdesc_create_struct (struct tdesc_feature *feature, const char *name)
{
- struct tdesc_type *type = XZALLOC (struct tdesc_type);
+ struct tdesc_type *type = XCNEW (struct tdesc_type);
type->name = xstrdup (name);
type->kind = TDESC_TYPE_STRUCT;
@@ -1341,7 +1341,7 @@ tdesc_set_struct_size (struct tdesc_type *type, LONGEST size)
struct tdesc_type *
tdesc_create_union (struct tdesc_feature *feature, const char *name)
{
- struct tdesc_type *type = XZALLOC (struct tdesc_type);
+ struct tdesc_type *type = XCNEW (struct tdesc_type);
type->name = xstrdup (name);
type->kind = TDESC_TYPE_UNION;
@@ -1354,7 +1354,7 @@ struct tdesc_type *
tdesc_create_flags (struct tdesc_feature *feature, const char *name,
LONGEST size)
{
- struct tdesc_type *type = XZALLOC (struct tdesc_type);
+ struct tdesc_type *type = XCNEW (struct tdesc_type);
type->name = xstrdup (name);
type->kind = TDESC_TYPE_FLAGS;
@@ -1436,7 +1436,7 @@ tdesc_free_feature (struct tdesc_feature *feature)
struct tdesc_feature *
tdesc_create_feature (struct target_desc *tdesc, const char *name)
{
- struct tdesc_feature *new_feature = XZALLOC (struct tdesc_feature);
+ struct tdesc_feature *new_feature = XCNEW (struct tdesc_feature);
new_feature->name = xstrdup (name);
@@ -1447,7 +1447,7 @@ tdesc_create_feature (struct target_desc *tdesc, const char *name)
struct target_desc *
allocate_target_description (void)
{
- return XZALLOC (struct target_desc);
+ return XCNEW (struct target_desc);
}
static void
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index b57adaa..bcc129b 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -342,7 +342,7 @@ windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
if ((th = thread_rec (id, FALSE)))
return th;
- th = XZALLOC (thread_info);
+ th = XCNEW (thread_info);
th->id = id;
th->h = h;
th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
@@ -729,7 +729,7 @@ windows_make_so (const char *name, LPVOID load_addr)
#endif
}
#endif
- so = XZALLOC (struct so_list);
+ so = XCNEW (struct so_list);
so->lm_info = (struct lm_info *) xmalloc (sizeof (struct lm_info));
so->lm_info->load_addr = load_addr;
strcpy (so->so_original_name, name);
diff --git a/gdb/xml-support.c b/gdb/xml-support.c
index 5d058b4..5062bc1 100644
--- a/gdb/xml-support.c
+++ b/gdb/xml-support.c
@@ -94,7 +94,7 @@ gdb_xml_body_text (void *data, const XML_Char *text, int length)
if (scope->body == NULL)
{
- scope->body = XZALLOC (struct obstack);
+ scope->body = XCNEW (struct obstack);
obstack_init (scope->body);
}
@@ -454,7 +454,7 @@ gdb_xml_create_parser_and_cleanup (const char *name,
struct cleanup *result;
/* Initialize the parser. */
- parser = XZALLOC (struct gdb_xml_parser);
+ parser = XCNEW (struct gdb_xml_parser);
parser->expat_parser = XML_ParserCreateNS (NULL, '!');
if (parser->expat_parser == NULL)
{
@@ -877,7 +877,7 @@ xml_process_xincludes (const char *name, const char *text,
struct cleanup *back_to;
char *result = NULL;
- data = XZALLOC (struct xinclude_parsing_data);
+ data = XCNEW (struct xinclude_parsing_data);
obstack_init (&data->obstack);
back_to = make_cleanup (xml_xinclude_cleanup, data);
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 986b75c..31d4ae6 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -126,7 +126,7 @@ static const char *xml_syscall_file = NULL;
static struct syscalls_info *
allocate_syscalls_info (void)
{
- return XZALLOC (struct syscalls_info);
+ return XCNEW (struct syscalls_info);
}
static void
@@ -161,7 +161,7 @@ static void
syscall_create_syscall_desc (struct syscalls_info *sysinfo,
const char *name, int number)
{
- struct syscall_desc *sysdesc = XZALLOC (struct syscall_desc);
+ struct syscall_desc *sysdesc = XCNEW (struct syscall_desc);
sysdesc->name = xstrdup (name);
sysdesc->number = number;
--
1.8.1.4