void g95_delete_bbt(void *root, void *old, int (*compare)()) { g95_bbt **t; t = (g95_bbt **) root; *t = delete_treap((g95_bbt *) old, *t, compare); }
void gfc_delete_bbt (void *root, void *old, compare_fn compare) { gfc_bbt **t; t = (gfc_bbt **) root; *t = delete_treap ((gfc_bbt *) old, *t, compare); }
static g95_bbt *delete_treap(g95_bbt *old, g95_bbt *t, int (*compare)()) { int c; if (t == NULL) return NULL; c = compare(old, t); if (c == 0) t = delete_root(t); else if (c < 0) t->left = delete_treap(old, t->left, compare); else if (c > 0) t->right = delete_treap(old, t->right, compare); return t; }
static gfc_bbt * delete_treap (gfc_bbt *old, gfc_bbt *t, compare_fn compare) { int c; if (t == NULL) return NULL; c = (*compare) (old, t); if (c < 0) t->left = delete_treap (old, t->left, compare); if (c > 0) t->right = delete_treap (old, t->right, compare); if (c == 0) t = delete_root (t); return t; }