123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- #include <assert.h>
- #include "private.h"
- void lub_bintree_remove(lub_bintree_t * this, void *clientnode)
- {
- lub_bintree_node_t *x, *t;
- lub_bintree_key_t key;
- int comp;
-
- this->getkeyFn(clientnode, &key);
-
- t = lub_bintree_splay(this, this->root, &key);
-
- comp = lub_bintree_compare(this, t, &key);
- assert(0 == comp);
- if (0 == comp) {
- if (t->left == NULL) {
- x = t->right;
- } else {
- x = lub_bintree_splay(this, t->left, &key);
- x->right = t->right;
- }
-
- this->root = x;
-
- lub_bintree_node_init(lub_bintree_getnode(this, clientnode));
- }
- }
|