Use std::string for ui_out_hdr's text fields

This patch makes ui_out_hdr use std::string for its text fields.  It
makes freeing automatic when the object is deleted.

gdb/ChangeLog:

	* mi/mi-out.c (mi_table_header): Change char * args to
	std::string.
	* cli-out.c (cli_table_header): Likewise.
	* ui-out.h (table_header_ftype): Likewise.
	(ui_out_table_header): Constify colhdr argument.
	(ui_out_query_field): Constify col_name argument.
	* ui-out.c (ui_out_hdr) <col_name, colhdr>: Change type to
	std::string.
	(uo_table_header): Change char * args to std::string.
	(ui_out_table_header): Likewise.
	(get_next_header): Constify colhdr argument and adapt.
	(clear_header_list): Don't free col_name/colhdr fields.
	(append_header_to_list): Change char * args to std::string and
	adapt.
	(verify_field): Constify variable.
	(ui_out_query_field): Constify col_name argument and adapt.
	* breakpoint.c (wrap_indent_at_field): Constify variable.
This commit is contained in:
Simon Marchi
2016-12-01 15:59:01 -05:00
committed by Simon Marchi
parent 78afa7f859
commit c520961526
6 changed files with 62 additions and 53 deletions

View File

@@ -6062,7 +6062,7 @@ wrap_indent_at_field (struct ui_out *uiout, const char *col_name)
{
static char wrap_indent[80];
int i, total_width, width, align;
char *text;
const char *text;
total_width = 0;
for (i = 1; ui_out_query_field (uiout, i, &width, &align, &text); i++)