/* Output generating routines for GDB.
- Copyright (C) 1999-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2015 Free Software Foundation, Inc.
Contributed by Cygnus Solutions.
Written by Fernando Nasser for Cygnus.
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
-#include "gdb_string.h"
#include "expression.h" /* For language.h */
#include "language.h"
#include "ui-out.h"
-#include "gdb_assert.h"
/* table header structures */
{
int flags;
/* Specific implementation of ui-out. */
- struct ui_out_impl *impl;
+ const struct ui_out_impl *impl;
void *data;
/* Current level. */
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);
/* This is the default ui-out implementation functions vector. */
-struct ui_out_impl default_ui_out_impl =
+const struct ui_out_impl default_ui_out_impl =
{
default_table_begin,
default_table_body,
{
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);
static void
clear_table (struct ui_out *uiout)
{
- if (uiout->table.id)
- xfree (uiout->table.id);
+ xfree (uiout->table.id);
+ uiout->table.id = NULL;
clear_header_list (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
/* Initalize private members at startup. */
struct ui_out *
-ui_out_new (struct ui_out_impl *impl, void *data,
+ui_out_new (const 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;
current->field_count = 0;
VEC_safe_push (ui_out_level_p, uiout->levels, current);
+ uiout->table.id = NULL;
uiout->table.header_first = NULL;
uiout->table.header_last = NULL;
uiout->table.header_next = NULL;