[FFmpeg-devel] [PATCH] Doxygenate libavutil/mem.h

Rich Felker dalias
Fri Sep 21 21:02:05 CEST 2007


On Fri, Sep 21, 2007 at 08:53:37PM +0300, Uoti Urpala wrote:
> On Fri, 2007-09-21 at 19:06 +0200, Stefano Sabatini wrote:
> > On date Friday 2007-09-21 08:18:45 -0400, Rich Felker encoded:
> > > On Fri, Sep 21, 2007 at 11:33:14AM +0200, Diego Biurrun wrote:
> > > > > + * Allocates or reallocates a block of memory.
> > > > > + * Same semantics as glibc realloc: if \p ptr is NULL and \p size > 0,
> > > > > + * identical to malloc(size). If \p size is zero, it is identical to
> > > > >   * free(ptr) and NULL is returned.
> > > 
> > > It would be better to cite a well-known standard, ANSI/ISO C, rather
> > > than glibc.... Realloc semantics are not glibc-specific.
> > 
> > Good point, changed "glibc" to "ANSI/ISO C".
> 
> ANSI/ISO C does not guarantee these semantics. A size-0 realloc need not
> return NULL.

Oh, sorry, I was looking at only half of it, the free behavior. You're
right, ANSI/ISO C allows returning a unique pointer that's utterly
useless. However, doesn't glibc actually take this second brain-dead
option? I know glibc's malloc returns a non-NULL value for
malloc(0)... not sure what realloc does.

Rich




More information about the ffmpeg-devel mailing list