Mercurial > libavutil.hg
comparison tree.h @ 734:ac8ea47c8d7e libavutil
Add @code/@endcode commands to markup C code in av_tree_insert() doxy.
author | stefano |
---|---|
date | Sat, 09 May 2009 23:02:20 +0000 |
parents | 6676b1979b68 |
children | ae61fe3a97b9 |
comparison
equal
deleted
inserted
replaced
733:6676b1979b68 | 734:ac8ea47c8d7e |
---|---|
59 * av_tree_node_size() will set it to the AVTreeNode which was | 59 * av_tree_node_size() will set it to the AVTreeNode which was |
60 * used for the removed element. | 60 * used for the removed element. |
61 * This allows the use of flat arrays, which have | 61 * This allows the use of flat arrays, which have |
62 * lower overhead compared to many malloced elements. | 62 * lower overhead compared to many malloced elements. |
63 * You might want to define a function like: | 63 * You might want to define a function like: |
64 * @code | |
64 * void *tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){ | 65 * void *tree_insert(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b), AVTreeNode **next){ |
65 * if(!*next) *next= av_mallocz(av_tree_node_size); | 66 * if(!*next) *next= av_mallocz(av_tree_node_size); |
66 * return av_tree_insert(rootp, key, cmp, next); | 67 * return av_tree_insert(rootp, key, cmp, next); |
67 * } | 68 * } |
68 * void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){ | 69 * void *tree_remove(struct AVTreeNode **rootp, void *key, int (*cmp)(void *key, const void *b, AVTreeNode **next)){ |
69 * if(*next) av_freep(next); | 70 * if(*next) av_freep(next); |
70 * return av_tree_insert(rootp, key, cmp, next); | 71 * return av_tree_insert(rootp, key, cmp, next); |
71 * } | 72 * } |
72 * | 73 * @endcode |
73 * @return If no insertion happened, the found element; if an insertion or | 74 * @return If no insertion happened, the found element; if an insertion or |
74 * removal happened, then either key or NULL will be returned. | 75 * removal happened, then either key or NULL will be returned. |
75 * Which one it is depends on the tree state and the implementation. You | 76 * Which one it is depends on the tree state and the implementation. You |
76 * should make no assumptions that it's one or the other in the code. | 77 * should make no assumptions that it's one or the other in the code. |
77 */ | 78 */ |