Browse Source

fix position of TR_TREE_FIND call

1.0.0
Georg Hopp 12 years ago
parent
commit
116911945e
  1. 4
      src/tree/insert.c

4
src/tree/insert.c

@ -30,8 +30,6 @@ TR_treeInsert(TR_Tree * this, const void * search, TR_TreeComp comp)
TR_Tree new_node = NULL;
int found;
TR_TREE_FIND(node, search, found, comp);
/*
* insert the node or return the one in tree if comparison
* succeeds.
@ -43,6 +41,8 @@ TR_treeInsert(TR_Tree * this, const void * search, TR_TreeComp comp)
*/
*this = node = new_node = TR_new(TR_Tree, search);
} else {
TR_TREE_FIND(node, search, found, comp);
if (found == 0) {
// we found an element
// as this is insert and not find this will overwrite an existing

Loading…
Cancel
Save