prioq: make prioq_reshuffle() void

We never use the return value, and it's confusing and kinda pointless
what we return there.

Hence drop it.

Originally noticed by: tristone13th <tristone13th@outlook.com>

Alternative to: #25810
This commit is contained in:
Lennart Poettering
2022-12-23 23:26:26 +01:00
parent b892124bdc
commit 8656f4a6ae
4 changed files with 5 additions and 9 deletions
+2 -3
View File
@@ -253,7 +253,7 @@ int prioq_remove(Prioq *q, void *data, unsigned *idx) {
return 1;
}
int prioq_reshuffle(Prioq *q, void *data, unsigned *idx) {
void prioq_reshuffle(Prioq *q, void *data, unsigned *idx) {
struct prioq_item *i;
unsigned k;
@@ -261,12 +261,11 @@ int prioq_reshuffle(Prioq *q, void *data, unsigned *idx) {
i = find_item(q, data, idx);
if (!i)
return 0;
return;
k = i - q->items;
k = shuffle_down(q, k);
shuffle_up(q, k);
return 1;
}
void *prioq_peek_by_index(Prioq *q, unsigned idx) {
+1 -1
View File
@@ -18,7 +18,7 @@ int prioq_ensure_allocated(Prioq **q, compare_func_t compare_func);
int prioq_put(Prioq *q, void *data, unsigned *idx);
int prioq_ensure_put(Prioq **q, compare_func_t compare_func, void *data, unsigned *idx);
int prioq_remove(Prioq *q, void *data, unsigned *idx);
int prioq_reshuffle(Prioq *q, void *data, unsigned *idx);
void prioq_reshuffle(Prioq *q, void *data, unsigned *idx);
void *prioq_peek_by_index(Prioq *q, unsigned idx) _pure_;
static inline void *prioq_peek(Prioq *q) {
+1 -1
View File
@@ -540,7 +540,7 @@ static void client_context_really_refresh(
if (c->in_lru) {
assert(c->n_ref == 0);
assert_se(prioq_reshuffle(s->client_contexts_lru, c, &c->lru_index) >= 0);
prioq_reshuffle(s->client_contexts_lru, c, &c->lru_index);
}
}
+1 -4
View File
@@ -3776,12 +3776,9 @@ static int event_prepare(sd_event *e) {
break;
s->prepare_iteration = e->iteration;
r = prioq_reshuffle(e->prepare, s, &s->prepare_index);
if (r < 0)
return r;
prioq_reshuffle(e->prepare, s, &s->prepare_index);
assert(s->prepare);
s->dispatching = true;
r = s->prepare(s, s->userdata);
s->dispatching = false;