prioq: add some minor overflow checking assert()s

This commit is contained in:
Lennart Poettering
2025-04-02 17:27:15 +02:00
parent bbcfac20a6
commit 39ce0324f9
+2
View File
@@ -199,6 +199,7 @@ static void remove_item(Prioq *q, struct prioq_item *i) {
/* Not last entry, let's replace the last entry with
* this one, and reshuffle */
assert(i >= q->items);
k = i - q->items;
i->data = l->data;
@@ -262,6 +263,7 @@ void prioq_reshuffle(Prioq *q, void *data, unsigned *idx) {
if (!i)
return;
assert(i >= q->items);
k = i - q->items;
k = shuffle_down(q, k);
shuffle_up(q, k);