Remove some manual memory management from compile interface
This changes gdb's compile code to use std::vector in a couple of places, rather than manual memory management. gdb/ChangeLog 2020-09-23 Tom Tromey <tom@tromey.com> * compile/compile-cplus-types.c (compile_cplus_convert_struct_or_union): Use std::vector. (compile_cplus_convert_func): Likewise. * compile/compile-c-types.c (convert_func): Use std::vector.
This commit is contained in:
parent
c4694f172b
commit
ebe824f5dc
3 changed files with 25 additions and 23 deletions
|
@ -176,13 +176,13 @@ convert_func (compile_c_instance *context, struct type *type)
|
|||
return_type = context->convert_type (target_type);
|
||||
|
||||
array.n_elements = type->num_fields ();
|
||||
array.elements = XNEWVEC (gcc_type, type->num_fields ());
|
||||
std::vector<gcc_type> elements (array.n_elements);
|
||||
array.elements = elements.data ();
|
||||
for (i = 0; i < type->num_fields (); ++i)
|
||||
array.elements[i] = context->convert_type (type->field (i).type ());
|
||||
|
||||
result = context->plugin ().build_function_type (return_type,
|
||||
&array, is_varargs);
|
||||
xfree (array.elements);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue