]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
prioq: make prioq_reshuffle() void
authorLennart Poettering <lennart@poettering.net>
Fri, 23 Dec 2022 17:49:02 +0000 (18:49 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 23 Dec 2022 22:26:26 +0000 (23:26 +0100)
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

src/basic/prioq.c
src/basic/prioq.h
src/journal/journald-context.c
src/libsystemd/sd-event/sd-event.c

index c15dcb26af8a185e42047a7b21a2ad1e434cb636..7e3356168880876da9d5255e491bb107d49956ce 100644 (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) {
index 508db88026e6a28378ac7922fa5c5e9b7aaa86ad..f66562f38764ef93553dc52b280e6125283f56ad 100644 (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) {
index 55e657c7e1fae501663e4c9abd7206126cb590d3..5f0c638d4747e3bf1fbcf897e50bab878182a3ee 100644 (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);
         }
 }
 
index ce1104b073edabaaa93f9a476335930615309433..6c15bc3ba7ded91bd9021807ddbfa741ab930c52 100644 (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;