From d0d292a27402ee2d3f91d541371f134f91730373 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 14 Oct 2017 08:42:23 -0400 Subject: Use std::vector for traceframe_info::tvars Straightforward change to get rid of a VEC. We need to new/delete traceframe_info instead of malloc/free it. I found three places that allocate a traceframe_info (ctf_traceframe_info, tfile_traceframe_info and parse_traceframe_info) and only one that frees it (free_traceframe_info). gdb/ChangeLog: * tracepoint.h (struct traceframe_info) : Change type to std::vector. * tracepoint.c (free_traceframe_info): Deallocate with delete. (traceframe_info_start_tvar): Adjust to vector change. (parse_traceframe_info): Allocate with new. * ctf.c (ctf_traceframe_info): Allocate with new, adjust to vector change. * tracefile-tfile.c (build_traceframe_info): Adjust to vector change. tfile_traceframe_info): Allocate with new. * mi/mi-main.c (mi_cmd_trace_frame_collected): Adjust to vector change. --- gdb/mi/mi-main.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gdb/mi') diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 5057f94..a94e329 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2724,12 +2724,9 @@ mi_cmd_trace_frame_collected (const char *command, char **argv, int argc) /* Trace state variables. */ { - int tvar; - int i; - ui_out_emit_list list_emitter (uiout, "tvars"); - for (i = 0; VEC_iterate (int, tinfo->tvars, i, tvar); i++) + for (int tvar : tinfo->tvars) { struct trace_state_variable *tsv; -- cgit v1.1