This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 2/3] Replace remaining cleanups in fbsd-nat.c.
- From: Pedro Alves <palves at redhat dot com>
- To: John Baldwin <jhb at FreeBSD dot org>, gdb-patches at sourceware dot org
- Date: Thu, 10 Aug 2017 14:24:52 +0100
- Subject: Re: [PATCH v2 2/3] Replace remaining cleanups in fbsd-nat.c.
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx07.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 F201DC07F98C
- References: <20170809174754.49166-1-jhb@FreeBSD.org> <20170809174754.49166-3-jhb@FreeBSD.org>
On 08/09/2017 06:47 PM, John Baldwin wrote:
> + gdb::unique_xmalloc_ptr<lwpid_t> lwps (XCNEWVEC (lwpid_t, nlwps));
> + lwpid_t lwp = lwps.get ()[i];
I was going to say:
~~~
Note that std::unique_ptr has an array version that avoids the
get() in "lwps.get ()[i]". I.e., with:
gdb::unique_xmalloc_ptr<lwpid_t[]> lwps (XCNEWVEC (lwpid_t, nlwps));
^^
you can then write the more natural:
lwpid_t lwp = lwps[i];
~~~
... but realized it doesn't work currently, because I missed adding
an xfree_deleter array specialization. Fixed now:
https://sourceware.org/ml/gdb-patches/2017-08/msg00212.html
Thanks,
Pedro Alves