X-Git-Url: https://pd.if.org/git/?p=jsw;a=blobdiff_plain;f=jsw_avltree.h;fp=jsw_avltree.h;h=aaaf76ea90aacc620ec781df3a4e3211e3bfa803;hp=089f8ef17fda5415c78d27d4a80b36ea82d1af33;hb=9fa959d28f32ae94111296c238b1e76caf152078;hpb=b8dc7e923f9cf71c3c722b872494fe639ba4621f diff --git a/jsw_avltree.h b/jsw_avltree.h index 089f8ef..aaaf76e 100644 --- a/jsw_avltree.h +++ b/jsw_avltree.h @@ -1,60 +1,60 @@ -#ifndef JSW_AVLTREE_H -#define JSW_AVLTREE_H - -/* - AVL balanced tree library - - > Created (Julienne Walker): June 17, 2003 - > Modified (Julienne Walker): September 24, 2005 - - This code is in the public domain. Anyone may - use it or change it in any way that they see - fit. The author assumes no responsibility for - damages incurred through use of the original - code or any variations thereof. - - It is requested, but not required, that due - credit is given to the original author and - anyone who has modified the code through - a header comment, such as this one. -*/ -#ifdef __cplusplus -#include - -using std::size_t; - -extern "C" { -#else -#include -#endif - -/* Opaque types */ -typedef struct jsw_avltree jsw_avltree_t; -typedef struct jsw_avltrav jsw_avltrav_t; - -/* User-defined item handling */ -typedef int (*cmp_f) ( const void *p1, const void *p2 ); -typedef void *(*dup_f) ( void *p ); -typedef void (*rel_f) ( void *p ); - -/* AVL tree functions */ -jsw_avltree_t *jsw_avlnew ( cmp_f cmp, dup_f dup, rel_f rel ); -void jsw_avldelete ( jsw_avltree_t *tree ); -void *jsw_avlfind ( jsw_avltree_t *tree, void *data ); -int jsw_avlinsert ( jsw_avltree_t *tree, void *data ); -int jsw_avlerase ( jsw_avltree_t *tree, void *data ); -size_t jsw_avlsize ( jsw_avltree_t *tree ); - -/* Traversal functions */ -jsw_avltrav_t *jsw_avltnew ( void ); -void jsw_avltdelete ( jsw_avltrav_t *trav ); -void *jsw_avltfirst ( jsw_avltrav_t *trav, jsw_avltree_t *tree ); -void *jsw_avltlast ( jsw_avltrav_t *trav, jsw_avltree_t *tree ); -void *jsw_avltnext ( jsw_avltrav_t *trav ); -void *jsw_avltprev ( jsw_avltrav_t *trav ); - -#ifdef __cplusplus -} -#endif - -#endif +#ifndef JSW_AVLTREE_H +#define JSW_AVLTREE_H + +/* + AVL balanced tree library + + > Created (Julienne Walker): June 17, 2003 + > Modified (Julienne Walker): September 24, 2005 + + This code is in the public domain. Anyone may + use it or change it in any way that they see + fit. The author assumes no responsibility for + damages incurred through use of the original + code or any variations thereof. + + It is requested, but not required, that due + credit is given to the original author and + anyone who has modified the code through + a header comment, such as this one. +*/ +#ifdef __cplusplus +#include + +using std::size_t; + +extern "C" { +#else +#include +#endif + +/* Opaque types */ +typedef struct jsw_avltree jsw_avltree_t; +typedef struct jsw_avltrav jsw_avltrav_t; + +/* User-defined item handling */ +typedef int (*cmp_f) ( const void *p1, const void *p2 ); +typedef void *(*dup_f) ( void *p ); +typedef void (*rel_f) ( void *p ); + +/* AVL tree functions */ +jsw_avltree_t *jsw_avlnew ( cmp_f cmp, dup_f dup, rel_f rel ); +void jsw_avldelete ( jsw_avltree_t *tree ); +void *jsw_avlfind ( jsw_avltree_t *tree, void *data ); +int jsw_avlinsert ( jsw_avltree_t *tree, void *data ); +int jsw_avlerase ( jsw_avltree_t *tree, void *data ); +size_t jsw_avlsize ( jsw_avltree_t *tree ); + +/* Traversal functions */ +jsw_avltrav_t *jsw_avltnew ( void ); +void jsw_avltdelete ( jsw_avltrav_t *trav ); +void *jsw_avltfirst ( jsw_avltrav_t *trav, jsw_avltree_t *tree ); +void *jsw_avltlast ( jsw_avltrav_t *trav, jsw_avltree_t *tree ); +void *jsw_avltnext ( jsw_avltrav_t *trav ); +void *jsw_avltprev ( jsw_avltrav_t *trav ); + +#ifdef __cplusplus +} +#endif + +#endif