5 void *tdelete(const void *restrict key, void **restrict rootp,
6 int(*cmp)(const void *, const void *))
12 struct node *n = *rootp;
16 /* *a[0] is an arbitrary non-null pointer that is returned when
17 the root node is deleted. */
23 int c = cmp(key, n->key);
31 /* free the preceding node instead of the deleted one. */
32 struct node *deleted = n;
39 deleted->key = n->key;
44 /* freed node has at most one child, move it up and rebalance. */
47 while (--i && __tsearch_balance(a[i]));