Change scope of *closest variable
This commit is contained in:
parent
f922b1c1e1
commit
06350df9ee
1 changed files with 3 additions and 2 deletions
|
@ -374,7 +374,7 @@ splay_node_t *splay_search_closest_greater_node(splay_tree_t *tree, const void *
|
||||||
/* Insertion and deletion */
|
/* Insertion and deletion */
|
||||||
|
|
||||||
splay_node_t *splay_insert(splay_tree_t *tree, void *data) {
|
splay_node_t *splay_insert(splay_tree_t *tree, void *data) {
|
||||||
splay_node_t *closest, *new;
|
splay_node_t *new;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if(!tree->root) {
|
if(!tree->root) {
|
||||||
|
@ -382,6 +382,7 @@ splay_node_t *splay_insert(splay_tree_t *tree, void *data) {
|
||||||
new->data = data;
|
new->data = data;
|
||||||
splay_insert_top(tree, new);
|
splay_insert_top(tree, new);
|
||||||
} else {
|
} else {
|
||||||
|
splay_node_t *closest;
|
||||||
closest = splay_search_closest_node(tree, data, &result);
|
closest = splay_search_closest_node(tree, data, &result);
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
|
@ -400,7 +401,6 @@ splay_node_t *splay_insert(splay_tree_t *tree, void *data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
splay_node_t *splay_insert_node(splay_tree_t *tree, splay_node_t *node) {
|
splay_node_t *splay_insert_node(splay_tree_t *tree, splay_node_t *node) {
|
||||||
splay_node_t *closest;
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
node->left = node->right = node->parent = node->next = node->prev = NULL;
|
node->left = node->right = node->parent = node->next = node->prev = NULL;
|
||||||
|
@ -408,6 +408,7 @@ splay_node_t *splay_insert_node(splay_tree_t *tree, splay_node_t *node) {
|
||||||
if(!tree->root)
|
if(!tree->root)
|
||||||
splay_insert_top(tree, node);
|
splay_insert_top(tree, node);
|
||||||
else {
|
else {
|
||||||
|
splay_node_t *closest;
|
||||||
closest = splay_search_closest_node(tree, node->data, &result);
|
closest = splay_search_closest_node(tree, node->data, &result);
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
|
|
Loading…
Reference in a new issue