diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2020-03-16 16:59:36 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2020-03-16 16:59:36 +0100 |
commit | c36c7fedf969fa49e832c7d2739ea4d1ad1108f2 (patch) | |
tree | 637a346344e1bc025ad82785cf0cc73011881fd9 /src/tree.h | |
parent | 47334cfaa2315828e6f7b959a1bde180c9c29604 (diff) | |
download | dns-c36c7fedf969fa49e832c7d2739ea4d1ad1108f2.tar.gz |
updated tree to be generic
Diffstat (limited to 'src/tree.h')
-rw-r--r-- | src/tree.h | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -9,6 +9,11 @@ #include <stdlib.h> #include <stdint.h> +#include <stdio.h> + +#define _TREE_FREE_DATA 0x01 +#define _TREE_FREE_KEY 0x02 + struct tree_node { char* key; void* data; @@ -20,9 +25,12 @@ int tree_insert ( struct tree_node** _root, char* _key, void* _data ); int tree_balance( struct tree_node** _root ); +/** + * Returns (void*)node->data on success, NULL on failure + * */ void* tree_get ( struct tree_node** _root, char* _query ); -int tree_destroy( struct tree_node** _root ); +int tree_destroy( struct tree_node** _root, uint8_t _options ); /** * ignore-case alphabetical string compare |