]> git.meshlink.io Git - meshlink/blobdiff - src/edge.c
Remove everything GPL that is not copyright Guus Sliepen, update copyright statements.
[meshlink] / src / edge.c
index 4d674f38ababcd60f0efa732dbc4df17fd802148..88847909c01b3fb9e31b19e5a08e1a444e293974 100644 (file)
@@ -1,7 +1,6 @@
 /*
     edge.c -- edge tree management
-    Copyright (C) 2000-2006 Guus Sliepen <guus@tinc-vpn.org>,
-                  2000-2005 Ivo Timmermans
+    Copyright (C) 2014 Guus Sliepen <guus@meshlink.io>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -28,7 +27,7 @@
 #include "utils.h"
 #include "xalloc.h"
 
-splay_tree_t *edge_weight_tree;        /* Tree with all edges, sorted on weight */
+splay_tree_t *edge_weight_tree;
 
 static int edge_compare(const edge_t *a, const edge_t *b) {
        return strcmp(a->to->name, b->to->name);
@@ -69,7 +68,7 @@ void exit_edges(void) {
 /* Creation and deletion of connection elements */
 
 edge_t *new_edge(void) {
-       return xmalloc_and_zero(sizeof(edge_t));
+       return xzalloc(sizeof(edge_t));
 }
 
 void free_edge(edge_t *e) {
@@ -98,34 +97,9 @@ void edge_del(edge_t *e) {
 
 edge_t *lookup_edge(node_t *from, node_t *to) {
        edge_t v;
-       
+
        v.from = from;
        v.to = to;
 
        return splay_search(from->edge_tree, &v);
 }
-
-int dump_edges(struct evbuffer *out) {
-       splay_node_t *node, *node2;
-       node_t *n;
-       edge_t *e;
-       char *address;
-
-       for(node = node_tree->head; node; node = node->next) {
-               n = node->data;
-               for(node2 = n->edge_tree->head; node2; node2 = node2->next) {
-                       e = node2->data;
-                       address = sockaddr2hostname(&e->address);
-                       if(evbuffer_add_printf(out,
-                                                                  " %s to %s at %s options %lx weight %d\n",
-                                                                  e->from->name, e->to->name, address,
-                                                                  e->options, e->weight) == -1) {
-                               free(address);
-                               return errno;
-                       }
-                       free(address);
-               }
-       }
-
-       return 0;
-}