Add q_last_type() queue function

Analogous to q_cur_type(), asserts that queue indices are within a valid
range.
This commit is contained in:
Justin Viiret
2015-10-30 09:43:28 +11:00
committed by Matthew Barr
parent a6383a54a4
commit cea914e18e
4 changed files with 12 additions and 4 deletions

View File

@@ -379,7 +379,7 @@ void ensureEnd(struct mq *q, UNUSED u32 qi, s64a final_loc) {
DEBUG_PRINTF("ensure MQE_END %lld for queue %u\n", final_loc, qi);
if (final_loc >= q_last_loc(q)) {
/* TODO: ensure situation does not arise */
assert(q->items[q->end - 1].type != MQE_END);
assert(q_last_type(q) != MQE_END);
pushQueueNoMerge(q, MQE_END, final_loc);
}
}