]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Remove automatic node deletion
authorQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 8 Sep 2016 18:14:16 +0000 (18:14 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Thu, 8 Sep 2016 18:14:16 +0000 (18:14 +0000)
Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/graph.c
lib/graph.h

index be7d5aef3851839d3e158b712cbea6fd64178184..314cf868509c6cf9829bb808aa8837b15127c2b0 100644 (file)
@@ -65,12 +65,6 @@ graph_delete_node (struct graph *graph, struct graph_node *node)
       for (unsigned int j = 0; j < vector_active (adj->to); j++)
         if (vector_slot (adj->to, j) == node)
           vector_unset (adj->to, j);
-
-      // if the node is orphaned, delete it
-      if (vector_active (adj->to) == 0 &&
-          vector_active (adj->from) == 0 &&
-          adj != node)
-          graph_delete_node (graph, adj);
     }
 
   // for all nodes that we have an edge to, remove us from their ->from
@@ -80,15 +74,9 @@ graph_delete_node (struct graph *graph, struct graph_node *node)
       for (unsigned int j = 0; j < vector_active (adj->from); j++)
         if (vector_slot (adj->from, j) == node)
           vector_unset (adj->from, j);
-
-      // if the node is orphaned, delete it
-      if (vector_active (adj->to) == 0 &&
-          vector_active (adj->from) == 0 &&
-          adj != node)
-          graph_delete_node (graph, adj);
     }
 
-  // if there is a deletion callback, call it!
+  // if there is a deletion callback, call it
   if (node->del && node->data)
     (*node->del) (node->data);
 
index bccbbb94a01452ce635c6e274258609df2b1eb86..b6a03b938aac19dcf867b9cd532f2d0c09b1c07a 100644 (file)
@@ -61,10 +61,6 @@ graph_new_node (struct graph *graph, void *data, void (*del) (void*));
  * Before deletion, this function removes all edges to and from this node from
  * any neighbor nodes.
  *
- * If, as a result of this operation, any neighbor node has no edges either to
- * or from itself, that node will be deleted as well. If the graph topology is
- * e.g. a star this will result in the deletion of all nodes.
- *
  * If *data and *del are non-null, the following call is made:
  *   (*node->del) (node->data);
  *