Do not insert edge into edge_weight_tree if not needed
This commit is contained in:
parent
bb3fd0a985
commit
0c334bb077
1 changed files with 8 additions and 5 deletions
13
src/edge.c
13
src/edge.c
|
@ -83,11 +83,6 @@ void free_edge(edge_t *e) {
|
|||
}
|
||||
|
||||
void edge_add(edge_t *e) {
|
||||
if (!splay_insert(edge_weight_tree, e))
|
||||
logger(DEBUG_ALWAYS, LOG_ERR,
|
||||
"%s:%d: edge from: %s to: %s exists in edge_weight_tree",
|
||||
__FUNCTION__, __LINE__, e->from->name, e->to->name);
|
||||
|
||||
if (splay_insert(e->from->edge_tree, e)) {
|
||||
e->reverse = lookup_edge(e->to, e->from);
|
||||
|
||||
|
@ -98,6 +93,14 @@ void edge_add(edge_t *e) {
|
|||
}
|
||||
e->reverse->reverse = e;
|
||||
}
|
||||
if (!splay_insert(edge_weight_tree, e))
|
||||
logger(DEBUG_ALWAYS, LOG_ERR,
|
||||
"%s:%d: edge from: %s to: %s exists in edge_weight_tree",
|
||||
__FUNCTION__, __LINE__, e->from->name, e->to->name);
|
||||
} else {
|
||||
logger(DEBUG_ALWAYS, LOG_ERR,
|
||||
"%s:%d: edge from: %s to: %s exists in from->edge_tree",
|
||||
__FUNCTION__, __LINE__, e->from->name, e->to->name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue