This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]