X-Git-Url: https://tinc-vpn.org/git/browse?p=tinc;a=blobdiff_plain;f=src%2Fnode.c;h=9d4d2f4393231556c7dba9376edaf22b219c2189;hp=61af6414f6fd7a0a920150a69c72abc2995a0f59;hb=f02d3ed3e135b5326003e7f69f8331ff6a3cc219;hpb=760dd966efe7dbff316a8c638e40dee162848256 diff --git a/src/node.c b/src/node.c index 61af6414..9d4d2f43 100644 --- a/src/node.c +++ b/src/node.c @@ -35,13 +35,11 @@ avl_tree_t *node_udp_tree; /* Known nodes, sorted by address and port */ node_t *myself; -static int node_compare(const node_t *a, const node_t *b) -{ +static int node_compare(const node_t *a, const node_t *b) { return strcmp(a->name, b->name); } -static int node_udp_compare(const node_t *a, const node_t *b) -{ +static int node_udp_compare(const node_t *a, const node_t *b) { int result; cp(); @@ -54,24 +52,21 @@ static int node_udp_compare(const node_t *a, const node_t *b) return (a->name && b->name) ? strcmp(a->name, b->name) : 0; } -void init_nodes(void) -{ +void init_nodes(void) { cp(); node_tree = avl_alloc_tree((avl_compare_t) node_compare, (avl_action_t) free_node); node_udp_tree = avl_alloc_tree((avl_compare_t) node_udp_compare, NULL); } -void exit_nodes(void) -{ +void exit_nodes(void) { cp(); avl_delete_tree(node_udp_tree); avl_delete_tree(node_tree); } -node_t *new_node(void) -{ +node_t *new_node(void) { node_t *n = xmalloc_and_zero(sizeof(*n)); cp(); @@ -86,8 +81,7 @@ node_t *new_node(void) return n; } -void free_node(node_t *n) -{ +void free_node(node_t *n) { cp(); if(n->queue) @@ -117,15 +111,13 @@ void free_node(node_t *n) free(n); } -void node_add(node_t *n) -{ +void node_add(node_t *n) { cp(); avl_insert(node_tree, n); } -void node_del(node_t *n) -{ +void node_del(node_t *n) { avl_node_t *node, *next; edge_t *e; subnet_t *s; @@ -147,8 +139,7 @@ void node_del(node_t *n) avl_delete(node_tree, n); } -node_t *lookup_node(char *name) -{ +node_t *lookup_node(char *name) { node_t n = {0}; cp(); @@ -158,8 +149,7 @@ node_t *lookup_node(char *name) return avl_search(node_tree, &n); } -node_t *lookup_node_udp(const sockaddr_t *sa) -{ +node_t *lookup_node_udp(const sockaddr_t *sa) { node_t n = {0}; cp(); @@ -170,8 +160,7 @@ node_t *lookup_node_udp(const sockaddr_t *sa) return avl_search(node_udp_tree, &n); } -void dump_nodes(void) -{ +void dump_nodes(void) { avl_node_t *node; node_t *n;