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) <tvars>: Change type to
	std::vector<int>.
	* 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.
This commit is contained in:
Simon Marchi 2017-10-14 08:42:23 -04:00 committed by Simon Marchi
parent 8d3c73ef6b
commit d0d292a274
6 changed files with 25 additions and 15 deletions

View file

@ -1638,7 +1638,7 @@ ctf_trace_find (struct target_ops *self, enum trace_find_type type, int num,
static struct traceframe_info *
ctf_traceframe_info (struct target_ops *self)
{
struct traceframe_info *info = XCNEW (struct traceframe_info);
traceframe_info *info = new traceframe_info;
const char *name;
struct bt_iter_pos *pos;
@ -1682,7 +1682,7 @@ ctf_traceframe_info (struct target_ops *self)
def = bt_ctf_get_field (event, scope, "num");
vnum = (int) bt_ctf_get_uint64 (def);
VEC_safe_push (int, info->tvars, vnum);
info->tvars.push_back (vnum);
}
else
{