This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: C++ bootstrap (part 10/n): Use XNEW, GCC_NEW etc.


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~


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