]> git.puffer.fish Git - matthieu/frr.git/commit
lib: graph: speed up node deletion
authorDavid Lamparter <equinox@opensourcerouting.org>
Thu, 26 Jan 2017 05:56:48 +0000 (06:56 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Thu, 26 Jan 2017 06:05:56 +0000 (07:05 +0100)
commit5bf313994d01bc05f0fe90fdb69322812c399440
tree36ba2fb8c91fdf8f1b6a4fa7ad16993f1879a891
parent72d98ee94360a5da0af76d8e800a72c8d51c48b5
lib: graph: speed up node deletion

We don't need to copy the from/to arrays, we can just iterate backwards.

NB: this makes graph_remove_edge delete only one edge (which is more
consistent with graph_add_edge allowing parallel edges).

Iterating graph->nodes backwards also makes graph_delete_graph faster
since that also iterates backwards.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/graph.c