struct xyla_bt_node **plink, **nlink, *root;
xyla_bt_updfn *updfn = cls ? cls->ops->upd : 0;
struct xyla_avl_path path;
- unsigned bal, trail, f;
+ unsigned f, bal, trail;
int ht, rc;
/* The trail. This is a similar idea to `xyla_avl_insert', except that we
if (ht < rht) { \
/* The subtree we're replacing is shorter than the right tree. \
* We can only get into this situation if its parent n was \
- * taller, so the n must be left-biased. We have some balance \
- * annotations to adjust; and the parent's height has \
+ * taller, so the node n must be left-biased. We have some \
+ * balance annotations to adjust; and the parent's height has \
* increased, so we'll have to ascend the tree. \
* \
* n \
n->avl.f = (n->avl.f&~XYLA_AVLF_BALMASK) | XYLA_AVLBAL_##RBIAS; \
if (updfn) { updfn(cls, &m->bt); updfn(cls, &n->bt); } \
} else if (BAL(NODE) != XYLA_AVLBAL_##RBIAS) { \
- /* The focus node not right-biased, and the subtree we're \
+ /* The focus node was not right-biased, and the subtree we're \
* replacing is the same height as the right tree. It's now \
* either evenly balanced, in which case we're done, or biased \
* to the right, in which case we must ascend. \
* There must, in fact, be a parent node. (If the right tree \
* has height h, then the focus node has height h + 1; if \
* that's the root, then we'd have done this the easy way.) If \
- * the parent was previously left-bias then it's now even and \
+ * the parent was previously left-biased then it's now even and \
* we're done; otherwise, we must ascend the tree. \
* \
* p \
*/
typedef void xyla_bt_idfn(struct xyla_bt_nodecls */*cls*/,
- const struct xyla_bt_node */*node*/,
- FILE */*fp*/);
+ const struct xyla_bt_node */*node*/, FILE */*fp*/);
/* Print a description of the NODE to the output stream FP. */
struct xyla_bt_chkopslots {
/* Check that the ordering is respected. */
subrc = xyla_bt_chkorder(op, chk);
- if (subrc < rc) rc = subrc;
+ if (subrc) { rc = subrc; if (subrc != XYLA_RC_BAD) goto end; }
/* Done. */
+end:
return (rc);
}
* from all of the trees we've been tracking.
*/
if (nodes) {
- puts("leaked nodes...");
+ fputs("leaked nodes...", out);
for (node = nodes; node; node = node->next)
fprintf(out, "\t#0x%08lx %lu\n", node->seq, node->k);
bail(BCAT_BUG, "leaked nodes");