Commit 6c67cc89 authored by Nils Goroll's avatar Nils Goroll Committed by Geoff Simmons

take 2: fix assert_nexus for partially delivered / unpended subtrees

The previous commit went in the right direction, but was not correct.

For CHK_ORDER, we must only ever look at type != T_NEXUS and check any
T_NEXUS by the criteria originally passed.

CHK_ORDER could be stricter still, after a subtree is completed, we
could communicate up the stricter CHK_PEND, but I do not want to
complicate things further for an assertion.
parent 2fff605e
......@@ -51,18 +51,28 @@ enum check_state {
static inline void assert_node(struct node *node, enum check_state check);
static inline void
assert_nexus(struct node *node, enum check_state check)
assert_nexus(struct node *node, enum check_state nexcheck)
{
struct node *child;
enum check_state check;
CHECK_OBJ_NOTNULL(node, NODE_MAGIC);
assert(node->type == T_NEXUS);
check = nexcheck;
VSTAILQ_FOREACH(child, &node->nexus.children, sibling) {
if (child->type == T_NEXUS) {
/*
* actually, we would need to communicate up from the
* subtree the fact that any <= ST_CLOSED was found and
* set check accordingly for CHK_ORDER as below, but
* still this is only an assertion....
*/
assert_node(child, nexcheck);
continue;
}
assert_node(child, check);
if (check == CHK_ORDER &&
child->type != T_NEXUS &&
child->state <= ST_CLOSED)
if (check == CHK_ORDER && child->state <= ST_CLOSED)
check = CHK_PEND;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment