[FFmpeg-cvslog] r22119 - in trunk/libavutil: tree.c tree.h

Michael Niedermayer michaelni
Tue Mar 2 23:09:11 CET 2010


On Tue, Mar 02, 2010 at 10:29:47PM +0100, Vitor Sessak wrote:
> Michael Niedermayer wrote:
>> On Tue, Mar 02, 2010 at 08:51:41PM +0100, Vitor Sessak wrote:
>>> Michael Niedermayer wrote:
>>>> On Tue, Mar 02, 2010 at 08:37:38PM +0100, Vitor Sessak wrote:
>>>>> Michael Niedermayer wrote:
>>>> [...]
>>>>> Ok, thanks. Attached patch fixes the function and use it to plug the 
>>>>> memleak.
>>>> attachment fell off the email during transport it seems
>>> Just to keep the tradition going ;)
>>>
>>> -Vitor
>>>  libavformat/nut.c    |   16 ++++++++++++++++
>>>  libavformat/nut.h    |    1 +
>>>  libavformat/nutdec.c |    1 +
>>>  libavformat/nutenc.c |    1 +
>>>  libavutil/avutil.h   |    2 +-
>>>  libavutil/tree.c     |    8 +++-----
>>>  libavutil/tree.h     |   13 +++++++++++++
>>>  7 files changed, 36 insertions(+), 6 deletions(-)
>>> 9060fad44f3129d750f0e334cd777283dc5c85ae  nuttree3.diff
>>> Index: libavutil/tree.c
>>> ===================================================================
>>> --- libavutil/tree.c	(revision 22135)
>>> +++ libavutil/tree.c	(working copy)
>>> @@ -135,16 +135,14 @@
>>>      }
>>>  }
>>>  -#if 0
>>> -void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void 
>>> *opaque, void *elem), int (*enu)(void *opaque, void *elem)){
>>> +void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void 
>>> *opaque, const void *elem), int (*enu)(void *opaque, void *elem)){
>>>      if(t){
>>>          int v= cmp ? cmp(opaque, t->elem) : 0;
>>> -        if(v>=0) av_tree_enumerate(t->child[0], opaque, cmp, enu);
>>> +        if(v==0 || v>=0) av_tree_enumerate(t->child[0], opaque, cmp, 
>>> enu);
>>>          if(v==0) enu(opaque, t->elem);
>>> -        if(v<=0) av_tree_enumerate(t->child[1], opaque, cmp, enu);
>>> +        if(v==0 || v<=0) av_tree_enumerate(t->child[1], opaque, cmp, 
>>> enu);
>> does your compile need this?
>
> No, it was my brain that needed this, I was reading ">" instead of ">=" 
> (and that was also why I wasn't understanding this code) :p
>
>>> Index: libavformat/nut.c
>>> ===================================================================
>>> --- libavformat/nut.c	(revision 22109)
>>> +++ libavformat/nut.c	(working copy)
>>> @@ -69,6 +69,22 @@
>>>      }
>>>  }
>>>  +static int cmp_always_0(void *a, const void *b)
>>> +{
>>> +    return 0;
>>> +}
>>> +
>>> +static void enu_free(void *opaque, void *elem)
>>> +{
>>> +    av_free(elem);
>>> +}
>>> +
>>> +void ff_nut_free_sp(NUTContext *nut)
>>> +{
>>> +    av_tree_enumerate(nut->syncpoints, NULL, cmp_always_0, enu_free);
>>> +    av_tree_destroy(nut->syncpoints);
>>> +}
>> NULL should work fine instead of cmp_always_0
>
> Sure, new patch attached.

attached, yes, new, no

[...]
> +static int cmp_always_0(void *a, const void *b)
> +{
> +    return 0;
> +}
> +
> +static void enu_free(void *opaque, void *elem)
> +{
> +    av_free(elem);
> +}
> +
> +void ff_nut_free_sp(NUTContext *nut)
> +{
> +    av_tree_enumerate(nut->syncpoints, NULL, cmp_always_0, enu_free);
> +    av_tree_destroy(nut->syncpoints);
> +}
> +

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20100302/0ea9e30e/attachment.pgp>



More information about the ffmpeg-cvslog mailing list