Commit a943fca9 authored by Vladimír Čunát's avatar Vladimír Čunát

Merge !754: kr_rplan_pop(): avoid reordering kr_rplan::pending

parents 72e13048 288cca5b
......@@ -253,7 +253,12 @@ int kr_rplan_pop(struct kr_rplan *rplan, struct kr_query *qry)
/* Find the query, it will likely be on top */
for (size_t i = rplan->pending.len; i > 0; i--) {
if (rplan->pending.at[i - 1] == qry) {
array_del(rplan->pending, i - 1);
/* Delete i-1 element by *sliding* the rest,
* contrary to array_del() */
for (size_t j = i; j < rplan->pending.len; ++j)
rplan->pending.at[j - 1] = rplan->pending.at[j];
array_pop(rplan->pending);
array_push(rplan->resolved, qry);
break;
}
......
......@@ -123,7 +123,10 @@ typedef array_t(struct kr_query *) kr_qarray_t;
* It also keeps a notion of current zone cut.
*/
struct kr_rplan {
kr_qarray_t pending; /**< List of pending queries. */
kr_qarray_t pending; /**< List of pending queries.
Beware: order is significant ATM,
as the last is the next one to solve,
and they may be inter-dependent. */
kr_qarray_t resolved; /**< List of resolved queries. */
struct kr_request *request; /**< Parent resolution request. */
knot_mm_t *pool; /**< Temporary memory pool. */
......
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