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

Pedro Alves palves@redhat.com
Thu Sep 28 09:46:00 GMT 2017


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



More information about the Gdb-patches mailing list