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