Re: [PATCH 6/7] jit: c++-ify gdb_block

Pedro Alves
2019-12-13T20:57:26Z

On 12/13/19 3:18 PM, Simon Marchi wrote:
> On 2019-12-13 10:10 a.m., Christian Biesinger via gdb-patches wrote:
>>> @@ -455,10 +463,7 @@ struct gdb_symtab
>>> ~gdb_symtab ()
>>> {
>>> for (gdb_block *gdb_block_iter : this->blocks)
>>> - {
>>> - xfree ((void *) gdb_block_iter->name);
>>> - xfree (gdb_block_iter);
>>> - }
>>> + delete gdb_block_iter;
>>> }
>>>
>>
>> Have you considered making this a vector of unique_ptrs, so you don't have
>> to manually delete them?
>
> Yes, it's done in the following patch. I went perhaps a bit overboard with the
> patch splitting, but I prefer to do these changes in many smaller patches, so that
> if something goes wrong, it's easier to identify the culprit.

I wonder whether it wouldn't be simpler to use std::list for these cases.

Thanks,
Pedro Alves