X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fconf.c;h=4dd8fe7a828888a2afc02111942744d0063501e7;hb=3a149f7521dfff67e6a790c1a830afc649ae083e;hp=90bd3697b9f0ae46b2af7fc63d34a6ec1a8e2262;hpb=bf81fce8ff7a244ecdfbe2d5535bdf4df07b3f35;p=tinc diff --git a/src/conf.c b/src/conf.c index 90bd3697..4dd8fe7a 100644 --- a/src/conf.c +++ b/src/conf.c @@ -34,8 +34,6 @@ #include "protocol.h" #include "xalloc.h" -splay_tree_t *config_tree = NULL; - int pinginterval = 0; /* seconds between pings */ int pingtimeout = 0; /* seconds to wait for response */ @@ -72,8 +70,21 @@ static int config_compare(const config_t *a, const config_t *b) { } } -void init_configuration(splay_tree_t **config_tree) { - *config_tree = splay_alloc_tree((splay_compare_t) config_compare, (splay_action_t) free_config); +splay_tree_t config_tree = { + .compare = (splay_compare_t) config_compare, + .delete = (splay_action_t) free_config, +}; + +splay_tree_t *create_configuration() { + splay_tree_t *tree = splay_alloc_tree(NULL, NULL); + init_configuration(tree); + return tree; +} + +void init_configuration(splay_tree_t *tree) { + memset(tree, 0, sizeof(*tree)); + tree->compare = (splay_compare_t) config_compare; + tree->delete = (splay_action_t) free_config; } void exit_configuration(splay_tree_t **config_tree) {