aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2009-11-14 11:19:08 +0000
committerMichael Niedermayer <michaelni@gmx.at>2009-11-14 11:19:08 +0000
commit1bf83b9548957e49d90804a035529085df4b872a (patch)
treeb7345da371352b3a39b3385ecc2bc7b01a0e76fe /libavutil
parent93d38cf6b056b3cfd16fb86e65d6db2deeb34fb7 (diff)
downloadffmpeg-1bf83b9548957e49d90804a035529085df4b872a.tar.gz
Make sure av_tree_enumerate() enumerates left->right.
Originally committed as revision 20535 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/tree.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavutil/tree.c b/libavutil/tree.c
index cce1d31090..0781453685 100644
--- a/libavutil/tree.c
+++ b/libavutil/tree.c
@@ -136,10 +136,11 @@ void av_tree_destroy(AVTreeNode *t){
}
#if 0
-void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*f)(void *opaque, void *elem)){
- int v= f(opaque, t->elem);
- if(v>=0) av_tree_enumerate(t->child[0], opaque, f);
- if(v<=0) av_tree_enumerate(t->child[1], opaque, f);
+void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, void *elem), int (*enu)(void *opaque, void *elem)){
+ int v= cmp ? cmp(opaque, t->elem) : 0;
+ if(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);
}
#endif