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: [PATCH v2 2/3] Replace remaining cleanups in fbsd-nat.c.


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


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