Re: [RFA 07/11] Use gdb::byte_vector in mi_cmd_data_write_memory_bytes

Pedro Alves
2017-09-28T09:46:53Z

On 09/12/2017 07:57 PM, Tom Tromey wrote:
> This changes mi_cmd_data_write_memory_bytes to use gdb::byte_vector,
> removing some cleanups.

Thanks.

>
> + gdb::byte_vector data;
> if (len_units < count_units)
> {
> /* Pattern is made of less units than count:
> repeat pattern to fill memory. */
> - data = (gdb_byte *) xmalloc (count_units * unit_size);
> - make_cleanup (xfree, data);
> + data = gdb::byte_vector (count_units * unit_size);

I think I'd have written instead:

data.resize (count_units * unit_size)

But OK either way.

Thanks,
Pedro Alves