From 47334cfaa2315828e6f7b959a1bde180c9c29604 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Mon, 16 Mar 2020 03:22:23 +0100 Subject: moved tree_* functions to tree.h/.c --- src/tree.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/tree.h (limited to 'src/tree.h') diff --git a/src/tree.h b/src/tree.h new file mode 100644 index 0000000..958b5ed --- /dev/null +++ b/src/tree.h @@ -0,0 +1,35 @@ +/* + * tree.h + * (c) 2019 Jonas Gunz + * License: MIT + * */ + +#pragma once + +#include +#include + +struct tree_node { + char* key; + void* data; + struct tree_node* above; + struct tree_node* below; +}; + +int tree_insert ( struct tree_node** _root, char* _key, void* _data ); + +int tree_balance( struct tree_node** _root ); + +void* tree_get ( struct tree_node** _root, char* _query ); + +int tree_destroy( struct tree_node** _root ); + +/** + * ignore-case alphabetical string compare + * returns: + * 0 :: _1 == _2 + * -1 :: _1 < _2 + * +1 :: _1 > _2 + * */ +int string_compare ( char* _1, char* _2 ); + -- cgit v1.2.3