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

Michael Niedermayer michaelni
Wed Mar 3 00:01:14 CET 2010


On Tue, Mar 02, 2010 at 11:26:26PM +0100, Vitor Sessak wrote:
> Michael Niedermayer wrote:
>> 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
>
> Today is not my day :(
>
> -Vitor

>  libavformat/nut.c    |   11 +++++++++++
>  libavformat/nut.h    |    1 +
>  libavformat/nutdec.c |    1 +
>  libavformat/nutenc.c |    1 +
>  libavutil/avutil.h   |    2 +-
>  libavutil/tree.c     |    2 --
>  libavutil/tree.h     |   13 +++++++++++++
>  7 files changed, 28 insertions(+), 3 deletions(-)
> 36c0786265abe676f2acdb6410c1c74ee28b421e  nuttree6.diff

looks ok

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

The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- 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/20100303/68cadadf/attachment.pgp>



More information about the ffmpeg-cvslog mailing list