+2016-11-30 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * ui-out.c (struct ui_out_table) <id>: Change type to
+ std::string.
+ (ui_out_table_begin): Change tblid parameter type to
+ std::string, adapt code.
+ update following type change.
+ (clear_table): Update.
+ (ui_out_new): Update.
+
2016-11-30 Simon Marchi <simon.marchi@polymtl.ca>
* cli-out.h (cli_ui_out_data) <streams>: Change type to
#include <vector>
#include <memory>
+#include <string>
/* table header structures */
/* String identifying the table (as specified in the table_begin
call). */
- char *id;
+ std::string id;
/* Points to the first table header (if any). */
struct ui_out_hdr *header_first;
static void
ui_out_table_begin (struct ui_out *uiout, int nbrofcols,
- int nr_rows,
- const char *tblid)
+ int nr_rows, const std::string &tblid)
{
if (uiout->table.flag)
internal_error (__FILE__, __LINE__,
uiout->table.body_flag = 0;
uiout->table.entry_level = uiout->level + 1;
uiout->table.columns = nbrofcols;
- if (tblid != NULL)
- uiout->table.id = xstrdup (tblid);
- else
- uiout->table.id = NULL;
+ uiout->table.id = tblid;
+
clear_header_list (uiout);
- uo_table_begin (uiout, nbrofcols, nr_rows, uiout->table.id);
+ uo_table_begin (uiout, nbrofcols, nr_rows, uiout->table.id.c_str ());
}
void
static void
clear_table (struct ui_out *uiout)
{
- xfree (uiout->table.id);
- uiout->table.id = NULL;
+ uiout->table.id.clear ();
clear_header_list (uiout);
}
current->field_count = 0;
uiout->levels.push_back (std::move (current));
- uiout->table.id = NULL;
uiout->table.header_first = NULL;
uiout->table.header_last = NULL;
uiout->table.header_next = NULL;