From 4cdd21a8d3fd943d6993e9d053edf09583802744 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 14 Oct 2017 08:43:54 -0400 Subject: Use std::vector for traceframe_info::memory Straightforward change from a VEC to std::vector. This allows making the destruction of a traceframe_info trivial. I added a constructor with parameters to mem_range to be able to emplace_back directly with the values. It is necessary to leave a default constructor there because mem_range is still used in a VEC. gdb/ChangeLog: * memrange.h (struct mem_range): Add constructors. * tracepoint.h (struct traceframe_info) : Change type to std::vector. * tracepoint.c (free_traceframe_info): Don't manually free vector. (traceframe_info_start_memory): Adjust to vector change. (traceframe_available_memory): Likewise. * tracefile-tfile.c (build_traceframe_info): Likewise. * ctf.c (ctf_traceframe_info): Likewise. --- gdb/tracefile-tfile.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'gdb/tracefile-tfile.c') diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c index 0075581..cc77b6c 100644 --- a/gdb/tracefile-tfile.c +++ b/gdb/tracefile-tfile.c @@ -1050,7 +1050,6 @@ build_traceframe_info (char blocktype, void *data) { case 'M': { - struct mem_range *r; ULONGEST maddr; unsigned short mlen; @@ -1064,10 +1063,7 @@ build_traceframe_info (char blocktype, void *data) 2, gdbarch_byte_order (target_gdbarch ())); - r = VEC_safe_push (mem_range_s, info->memory, NULL); - - r->start = maddr; - r->length = mlen; + info->memory.emplace_back (maddr, mlen); break; } case 'V': -- cgit v1.1