This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ bootstrap (part 10/n): Use XNEW, GCC_NEW etc.
- From: Richard Henderson <rth at redhat dot com>
- To: Bernardo Innocenti <bernie at develer dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 25 Jul 2004 18:11:37 -0700
- Subject: Re: C++ bootstrap (part 10/n): Use XNEW, GCC_NEW etc.
- References: <41041D1B.3040500@develer.com>
On Sun, Jul 25, 2004 at 10:50:35PM +0200, Bernardo Innocenti wrote:
> if (spelling_base == 0)
> spelling_base = xmalloc (spelling_size * sizeof (struct spelling));
> else
> spelling_base = xrealloc (spelling_base,
> spelling_size * sizeof (struct spelling));
>
> I was under the impression that any implementation of realloc() could
> deal with a NULL pointer for its first argument. Supposing it was
> done like that for a reason, so I've just converted it to use XNEWVEC
> and XRESIZEVEC.
Not for a reason. Regardless of the libc implementation, xrealloc
does do the right thing with null input.
r~