On 15/09/13 21:51, Diego Biurrun wrote: > av_reallocp() > > On Sun, Sep 15, 2013 at 09:44:49PM +0200, Luca Barbato wrote: >> --- a/libavutil/mem.h >> +++ b/libavutil/mem.h >> @@ -117,6 +117,25 @@ av_alloc_size(1, 2) static inline void >> *av_malloc_array(size_t nmemb, size_t siz >> void *av_realloc(void *ptr, size_t size) av_alloc_size(2); >> >> /** >> + * Allocate or reallocate an block of memory. > > a block
right forgot to save. > >> + * If *ptr is NULL and size > 0, allocate a new block. If >> + * size is zero, free the memory block pointed to by ptr. >> + * @param ptr Pointer to a pointer to a memory block already allocated >> + * with av_realloc(), or pointer to a pointer to NULL. >> + * The pointer is updated on success, or freed on failure. >> + * @param size Size in bytes for the memory block to be allocated or >> + * reallocated >> + * @return Zero on success, an AVERROR error code on failure. >> + * @warning Pointers originating from the av_malloc() family of functions >> must >> + * not be passed to av_reallocp(). The former can be implemented >> using >> + * memalign() (or other functions), and there is no guarantee that >> + * pointers from such functions can be passed to realloc() at all. >> + * The situation is undefined according to POSIX and may crash with >> + * some libc implementations. >> + */ >> +int av_reallocp(void *ptr, size_t size); > > Please indent the parameter description text like the @warning paragraph. * Allocate or reallocate a block of memory. * If *ptr is NULL and size > 0, allocate a new block. If * size is zero, free the memory block pointed to by ptr. * @param ptr Pointer to a pointer to a memory block already allocated * with av_realloc(), or pointer to a pointer to NULL. * The pointer is updated on success, or freed on failure. * @param size Size in bytes for the memory block to be allocated or * reallocated * @return Zero on success, an AVERROR error code on failure. * @warning Pointers originating from the av_malloc() family of functions must * not be passed to av_reallocp(). The former can be implemented using * memalign() (or other functions), and there is no guarantee that * pointers from such functions can be passed to realloc() at all. * The situation is undefined according to POSIX and may crash with * some libc implementations. Like this? lu _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
