| OLD | NEW |
| 1 /* | 1 /* |
| 2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> | 2 * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at> |
| 3 * | 3 * |
| 4 * This file is part of FFmpeg. | 4 * This file is part of FFmpeg. |
| 5 * | 5 * |
| 6 * FFmpeg is free software; you can redistribute it and/or | 6 * FFmpeg is free software; you can redistribute it and/or |
| 7 * modify it under the terms of the GNU Lesser General Public | 7 * modify it under the terms of the GNU Lesser General Public |
| 8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
| 9 * version 2.1 of the License, or (at your option) any later version. | 9 * version 2.1 of the License, or (at your option) any later version. |
| 10 * | 10 * |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 void av_tree_destroy(AVTreeNode *t){ | 130 void av_tree_destroy(AVTreeNode *t){ |
| 131 if(t){ | 131 if(t){ |
| 132 av_tree_destroy(t->child[0]); | 132 av_tree_destroy(t->child[0]); |
| 133 av_tree_destroy(t->child[1]); | 133 av_tree_destroy(t->child[1]); |
| 134 av_free(t); | 134 av_free(t); |
| 135 } | 135 } |
| 136 } | 136 } |
| 137 | 137 |
| 138 #if 0 | |
| 139 void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, voi
d *elem), int (*enu)(void *opaque, void *elem)){ | 138 void av_tree_enumerate(AVTreeNode *t, void *opaque, int (*cmp)(void *opaque, voi
d *elem), int (*enu)(void *opaque, void *elem)){ |
| 140 if(t){ | 139 if(t){ |
| 141 int v= cmp ? cmp(opaque, t->elem) : 0; | 140 int v= cmp ? cmp(opaque, t->elem) : 0; |
| 142 if(v>=0) av_tree_enumerate(t->child[0], opaque, cmp, enu); | 141 if(v>=0) av_tree_enumerate(t->child[0], opaque, cmp, enu); |
| 143 if(v==0) enu(opaque, t->elem); | 142 if(v==0) enu(opaque, t->elem); |
| 144 if(v<=0) av_tree_enumerate(t->child[1], opaque, cmp, enu); | 143 if(v<=0) av_tree_enumerate(t->child[1], opaque, cmp, enu); |
| 145 } | 144 } |
| 146 } | 145 } |
| 147 #endif | |
| 148 | 146 |
| 149 #ifdef TEST | 147 #ifdef TEST |
| 150 | 148 |
| 151 #include "lfg.h" | 149 #include "lfg.h" |
| 152 | 150 |
| 153 static int check(AVTreeNode *t){ | 151 static int check(AVTreeNode *t){ |
| 154 if(t){ | 152 if(t){ |
| 155 int left= check(t->child[0]); | 153 int left= check(t->child[0]); |
| 156 int right= check(t->child[1]); | 154 int right= check(t->child[1]); |
| 157 | 155 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j); | 205 av_log(NULL, AV_LOG_ERROR, "removing %4d\n", j); |
| 208 av_tree_insert(&root, (void*)(j+1), cmp, &node2); | 206 av_tree_insert(&root, (void*)(j+1), cmp, &node2); |
| 209 k= av_tree_find(root, (void*)(j+1), cmp, NULL); | 207 k= av_tree_find(root, (void*)(j+1), cmp, NULL); |
| 210 if(k) | 208 if(k) |
| 211 av_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i); | 209 av_log(NULL, AV_LOG_ERROR, "removal failure %d\n", i); |
| 212 } | 210 } |
| 213 } | 211 } |
| 214 return 0; | 212 return 0; |
| 215 } | 213 } |
| 216 #endif | 214 #endif |
| OLD | NEW |