[FFmpeg-cvslog] r22119 - in trunk/libavutil: tree.c tree.h
Vitor Sessak
vitor1001
Tue Mar 2 06:40:03 CET 2010
Michael Niedermayer wrote:
> On Sun, Feb 28, 2010 at 09:48:42PM +0100, vitor wrote:
>> Author: vitor
>> Date: Sun Feb 28 21:48:42 2010
>> New Revision: 22119
>>
>> Log:
>> Implement av_tree_destroy_free_elem() to destroy a tree and free all the
>> values stored on it.
>>
>> Modified:
>> trunk/libavutil/tree.c
>> trunk/libavutil/tree.h
>>
>> Modified: trunk/libavutil/tree.c
>> ==============================================================================
>> --- trunk/libavutil/tree.c Sun Feb 28 20:58:26 2010 (r22118)
>> +++ trunk/libavutil/tree.c Sun Feb 28 21:48:42 2010 (r22119)
>> @@ -135,6 +135,15 @@ void av_tree_destroy(AVTreeNode *t){
>> }
>> }
>>
>> +void av_tree_destroy_free_elem(AVTreeNode *t){
>> + if(t){
>> + av_tree_destroy_free_elem(t->child[0]);
>> + av_tree_destroy_free_elem(t->child[1]);
>> + av_free(t->elem);
>> + av_free(t);
>> + }
>> +}
>> +
>> #if 0
>> void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem)){
>> if(t){
>>
>> Modified: trunk/libavutil/tree.h
>> ==============================================================================
>> --- trunk/libavutil/tree.h Sun Feb 28 20:58:26 2010 (r22118)
>> +++ trunk/libavutil/tree.h Sun Feb 28 21:48:42 2010 (r22119)
>> @@ -78,5 +78,6 @@ void *av_tree_find(const struct AVTreeNo
>> */
>> void *av_tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), struct AVTreeNode **next);
>> void av_tree_destroy(struct AVTreeNode *t);
>> +void av_tree_destroy_free_elem(struct AVTreeNode *t);
>
> argh, ive missed this part of your patch
>
> minor api bump & doxy missing and its the wrong way to do it
> you dont know at all if avfree() is correct and sufficient to free the
> opaque elements.
> av_tree_enumerate() is likely the correct way to free
Ok, but current version of av_tree_enumerate() is commented out and does
not do what one would expect. What do you think of this patch?
-Vitor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nuttree.diff
Type: text/x-patch
Size: 3703 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-cvslog/attachments/20100302/06aa9348/attachment.bin>
More information about the ffmpeg-cvslog
mailing list