[FFmpeg-devel] [PATCH] lavu/mem: extend documentation for av_dynarray_add()

Stefano Sabatini stefasab at gmail.com
Sat Apr 27 18:58:46 CEST 2013


On date Thursday 2013-04-25 12:25:14 +0200, Nicolas George encoded:
> Le sextidi 6 floréal, an CCXXI, Stefano Sabatini a écrit :
> > ---
> >  libavutil/mem.h |   14 +++++++++++---
> >  1 file changed, 11 insertions(+), 3 deletions(-)
> > 
> > diff --git a/libavutil/mem.h b/libavutil/mem.h
> > index ced9453..8ae0939 100644
> > --- a/libavutil/mem.h
> > +++ b/libavutil/mem.h
> > @@ -191,9 +191,17 @@ void av_freep(void *ptr);
> >  /**
> >   * Add an element to a dynamic array.
> >   *
> > - * @param tab_ptr Pointer to the array.
> > - * @param nb_ptr  Pointer to the number of elements in the array.
> > - * @param elem    Element to be added.
> > + * The array to add is supposed to be an array of pointers to
> > + * structures, and the element to add must be a pointer to an already
> > + * allocated structure.
> > + *
> > + * In case of success, the pointer to the array is updated in order to
> 
> > + * contain the new growed array, and the number pointed to by nb_ptr
> 
> growed -> grown
> 
> And possibly "to contain" -> "to point to".
> 
> > + * is incremented.
> 

> A note about efficiency would be nice:
> 
>  * The array is reallocated when its sizes reaches powers of 2.
>  * Therefore, the amortized cost of adding an element is constant.

I'm skipping this since I'm not sure it is a good idea to expose
implementation details in the doxy.

> > + *
> > + * @param tab_ptr pointer to the array to grow
> > + * @param nb_ptr  pointer to the number of elements in the array
> > + * @param elem    element to add
> >   */
> >  void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem);
> 
> Regards,

Will push it soon.
-- 
FFmpeg = Furious and Foolish Mythic Pacific EnGine
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-lavu-mem-extend-documentation-for-av_dynarray_add.patch
Type: text/x-diff
Size: 1243 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130427/84b3bedb/attachment.bin>


More information about the ffmpeg-devel mailing list