core/dbus: modernize bus_foreach_bus
This commit is contained in:
+9
-11
@@ -1113,31 +1113,29 @@ int bus_foreach_bus(
|
||||
int (*send_message)(sd_bus *bus, void *userdata),
|
||||
void *userdata) {
|
||||
|
||||
sd_bus *b;
|
||||
int r, ret = 0;
|
||||
int r = 0;
|
||||
|
||||
assert(m);
|
||||
assert(send_message);
|
||||
|
||||
/* Send to all direct buses, unconditionally */
|
||||
sd_bus *b;
|
||||
SET_FOREACH(b, m->private_buses) {
|
||||
|
||||
/* Don't bother with enqueuing these messages to clients that haven't started yet */
|
||||
if (sd_bus_is_ready(b) <= 0)
|
||||
continue;
|
||||
|
||||
r = send_message(b, userdata);
|
||||
if (r < 0)
|
||||
ret = r;
|
||||
RET_GATHER(r, send_message(b, userdata));
|
||||
}
|
||||
|
||||
/* Send to API bus, but only if somebody is subscribed */
|
||||
if (m->api_bus &&
|
||||
(sd_bus_track_count(m->subscribed) > 0 ||
|
||||
sd_bus_track_count(subscribed2) > 0)) {
|
||||
r = send_message(m->api_bus, userdata);
|
||||
if (r < 0)
|
||||
ret = r;
|
||||
}
|
||||
sd_bus_track_count(subscribed2) > 0))
|
||||
RET_GATHER(r, send_message(m->api_bus, userdata));
|
||||
|
||||
return ret;
|
||||
return r;
|
||||
}
|
||||
|
||||
void bus_track_serialize(sd_bus_track *t, FILE *f, const char *prefix) {
|
||||
|
||||
Reference in New Issue
Block a user