+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.
}
/* 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;
return arches->gdbarch;
}
- tdep = XMALLOC (struct gdbarch_tdep);
+ tdep = XNEW (struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
tdep->bfin_abi = abi;
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);
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);
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);
{
if ((*c) != NULL)
return (*c);
- (*c) = XMALLOC (struct complaints);
+ (*c) = XNEW (struct complaints);
(*c)->root = &complaint_sentinel;
(*c)->series = ISOLATED_MESSAGE;
(*c)->explanation = NULL;
}
/* 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;
/* 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"
{
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;
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,
/* 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));
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;
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;
/* 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;
/* 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));
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;
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;
/* 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;
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;
{
struct interp *new_interp;
- new_interp = XMALLOC (struct interp);
+ new_interp = XNEW (struct interp);
new_interp->name = xstrdup (name);
new_interp->data = NULL;
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. */
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);
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;
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;
{
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;
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));
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);
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);
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;
}
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)
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;
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, _("\
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;
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;
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
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;
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];
if (!ops)
return NULL;
- scb = XMALLOC (struct serial);
+ scb = XNEW (struct serial);
scb->ops = ops;
/* 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 */
{
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;
{
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;
{
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);
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);
{
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);
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);
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);
{
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);
{
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
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;
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