This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 07/11] Use gdb::byte_vector in mi_cmd_data_write_memory_bytes
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tom at tromey dot com>, gdb-patches at sourceware dot org
- Date: Thu, 28 Sep 2017 10:46:44 +0100
- Subject: Re: [RFA 07/11] Use gdb::byte_vector in mi_cmd_data_write_memory_bytes
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=palves at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DA036C3A95
- References: <20170912185736.20436-1-tom@tromey.com> <20170912185736.20436-8-tom@tromey.com>
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