On Mon, Sep 09, 2013 at 02:00:42PM +0200, Luca Barbato wrote:
> On 08/09/13 23:28, Diego Biurrun wrote:
> > On Sun, Sep 08, 2013 at 08:09:17AM +0200, Luca Barbato wrote:
> >> --- a/libavutil/mem.h
> >> +++ b/libavutil/mem.h
> >> @@ -100,14 +100,14 @@ av_alloc_size(1, 2) static inline void 
> >> *av_malloc_array(size_t nmemb, size_t siz
> >>   * 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.
> >> + * @note Pointers provided by av_malloc family of functions cannot be
> >> + * passed to av_realloc().
> >>   * @param ptr Pointer to a memory block already allocated with
> >>   * av_realloc() or NULL.
> >>   * @param size Size in bytes of the memory block to be allocated or
> >>   * reallocated.
> >>   * @return Pointer to a newly-reallocated block or NULL if the block
> >>   * cannot be reallocated or the function is used to free the memory block.
> >> - * @note av_realloc() is not guaranteed to maintain the alignment of
> >> - *       pointers originating from the av_malloc() family of functions.
> >>   * @see av_fast_realloc()
> >>   */
> > 
> > This brings back the previous unclear wording.  You can very much pass
> > pointers from av_malloc() to av_realloc() - it's just that the result
> 
> As you can do 1/0 or ((char *)NULL)[-1] with equally surprising results.
> 
> There isn't much unclear, I can use MUST (as in rfc-speak) but that's
> the substance.

It is unclear because it does not explain the reason why you cannot pass
the pointers.  I tried previously to be more explicit, but my explanation
was not quite correct.  It does not follow from that failure that no
explanation should be provided instead.

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to