[PATCHv2 3/3] gdb: Remove a use of VEC from dwarf2read.{c,h}

Tom Tromey tom@tromey.com
Wed Sep 25 22:08:00 GMT 2019


>>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:

Andrew> Removes a use of VEC from dwarf2read.{c,h} and replaces it with
Andrew> std::vector.  As far as possible this is a like for like replacement
Andrew> with minimal refactoring.

Andrew> +  if (tu_group->tus == nullptr)
Andrew> +    tu_group->tus = new std::vector <signatured_type *>;
Andrew> +  tu_group->tus->push_back (sig_type);

Andrew> +  int len = tu_group->tus->size ();

Is it possible to reach here with tus==nullptr?

Andrew> +  for (i = 0; i < tu_group->tus->size (); ++i)

Likewise.

Andrew> -  VEC_free (sig_type_ptr, tu_group->tus);
Andrew> +  delete tu_group->tus;
 
VEC_free resets tus to nullptr, but I don't know whether or not that's
important.

Tom



More information about the Gdb-patches mailing list