freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Devel] problem with ft_mem_debug_realloc


From: Antoine Leca
Subject: Re: [Devel] problem with ft_mem_debug_realloc
Date: Thu, 6 May 2004 16:51:14 +0200

On Thursday, May 06, 2004 9:16 AM
Werner LEMBERG <address@hidden> va escriure:
[ realloc tests if passed pointer is NULL and chokes ]
> Why?  According to the realloc() man page,
> this case is equivalent to malloc(), thus valid.

And according to the C standard also.

However, some seem to have (or have had) other ideas regarding that. Look at
<http://gcc.gnu.org/ml/gcc-patches/2000-04/msg00153.html>. It is well known
for free(NULL) that should be avoided, but the guy here also mentionned
realloc(NULL, ).

A further refined research
(http://www.google.es/search?hl=xx-hacker&q=realloc+sunos) shows quite
repeatedly that some obsolete but widely used distro is convicted here. I
never had the chance to test it (read SIGSEGV), but it is probably something
that might be taken in account.

And yes, I am sorry, because it might make things messier.

OTOH, we can easily say "we need an ANSI compiler, and some level of
compliance of the ANSI library as well; for example realloc(NULL, ) should
work."  A adequate test in autoconf might be a good thing to consider as
well, if possible (don't trust AC_FUNC_REALLOC though, it is too picky: it
insists that realloc(, 0) returns non-NULL, which is another story
entirely).

In fact, *this* is probably the way to go. Go ANSI, go!


Antoine




reply via email to

[Prev in Thread] Current Thread [Next in Thread]