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:
+2
-3
@@ -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
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user