diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2016-12-01 15:59:01 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@ericsson.com> | 2016-12-01 15:59:03 -0500 |
commit | c5209615263fd0444da28cdfb6661ad287909a70 (patch) | |
tree | 953526cb2bd235560908c252c52b3e776bf4cddf /gdb/mi | |
parent | 78afa7f8599e46eb94a93510b383dfb35e549f7e (diff) | |
download | gdb-c5209615263fd0444da28cdfb6661ad287909a70.zip gdb-c5209615263fd0444da28cdfb6661ad287909a70.tar.gz gdb-c5209615263fd0444da28cdfb6661ad287909a70.tar.bz2 |
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.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-out.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gdb/mi/mi-out.c b/gdb/mi/mi-out.c index b4da3ba..9a2cb83 100644 --- a/gdb/mi/mi-out.c +++ b/gdb/mi/mi-out.c @@ -41,8 +41,9 @@ static void mi_table_begin (struct ui_out *uiout, int nbrofcols, static void mi_table_body (struct ui_out *uiout); static void mi_table_end (struct ui_out *uiout); static void mi_table_header (struct ui_out *uiout, int width, - enum ui_align alig, const char *col_name, - const char *colhdr); + enum ui_align alignment, + const std::string &col_name, + const std::string &col_hdr); static void mi_begin (struct ui_out *uiout, enum ui_out_type type, int level, const char *id); static void mi_end (struct ui_out *uiout, enum ui_out_type type, int level); @@ -140,7 +141,7 @@ mi_table_end (struct ui_out *uiout) void mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment, - const char *col_name, const char *colhdr) + const std::string &col_name, const std::string &col_hdr) { mi_out_data *data = (mi_out_data *) ui_out_data (uiout); @@ -150,8 +151,8 @@ mi_table_header (struct ui_out *uiout, int width, enum ui_align alignment, mi_open (uiout, NULL, ui_out_type_tuple); mi_field_int (uiout, 0, 0, ui_center, "width", width); mi_field_int (uiout, 0, 0, ui_center, "alignment", alignment); - mi_field_string (uiout, 0, 0, ui_center, "col_name", col_name); - mi_field_string (uiout, 0, width, alignment, "colhdr", colhdr); + mi_field_string (uiout, 0, 0, ui_center, "col_name", col_name.c_str ()); + mi_field_string (uiout, 0, width, alignment, "colhdr", col_hdr.c_str ()); mi_close (uiout, ui_out_type_tuple); } |