This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA-v2/ARI fix] Remove use of abort function in common/buffer.c
- From: Pedro Alves <palves at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>, gdb-patches at sourceware dot org
- Date: Tue, 22 May 2012 13:38:29 +0100
- Subject: Re: [RFA-v2/ARI fix] Remove use of abort function in common/buffer.c
- References: <4fbb59b7.44e2440a.48c4.ffffab13SMTPIN_ADDED@mx.google.com> <4FBB5D9B.5070202@redhat.com> <000c01cd3813$32090b40$961b21c0$@muller@ics-cnrs.unistra.fr> <20120522121832.GC5492@adacore.com>
On 05/22/2012 01:18 PM, Joel Brobecker wrote:
> Hi Pierre, Hi Pedro,
>
> Thanks for taking care of this, Pierre.
>
>> + /* new_buffer is non NULL otherwise
>> + xrealloc calls malloc_failure which does not return here. */
>
> I suggest a slightly different way of saying this:
>
> /* xrealloc guaranties that new_buffer cannot be null. */
>
> It avoids the problem with the location of the line break and any issue
> with punctuation...
>
Fine with me, but I'd suggest to just say nothing. The whole point of the xrealloc,
xmalloc, etc. functions is to abort on failure instead of returning NULL. We have
about 150 or so xrealloc calls in the tree, about 70 xcalloc calls, and
about 700 xmalloc calls. We don't put just comment on most (any?) of those, and
I don't see what makes this particular instance special.
--
Pedro Alves