diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-04-28 20:48:54 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-04-28 21:34:23 +0200 |
commit | fe506d569d82467f31862c2ed82ef35f88854149 (patch) | |
tree | fe8b56db3a8a14954c4c240547ac6e92b5cc2fd3 /src | |
parent | 1a2399e57d9f5943a508720aaddc87512a972378 (diff) |
bus-util: drop redundant bus argument from bus_message_map_all_properties() and related calls
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-terminal/idev-keyboard.c | 2 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-util.c | 44 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/bus-util.h | 16 |
3 files changed, 29 insertions, 33 deletions
diff --git a/src/libsystemd-terminal/idev-keyboard.c b/src/libsystemd-terminal/idev-keyboard.c index 05f5e0cd06..b5eb7371ab 100644 --- a/src/libsystemd-terminal/idev-keyboard.c +++ b/src/libsystemd-terminal/idev-keyboard.c @@ -462,7 +462,7 @@ static int kbdctx_locale_props_changed_fn(sd_bus *bus, if (r < 0) goto error; - r = bus_message_map_properties_changed(bus, signal, kbdctx_locale_map, kc); + r = bus_message_map_properties_changed(signal, kbdctx_locale_map, kc); if (r < 0) goto error; diff --git a/src/libsystemd/sd-bus/bus-util.c b/src/libsystemd/sd-bus/bus-util.c index 258265dca7..31bd45c687 100644 --- a/src/libsystemd/sd-bus/bus-util.c +++ b/src/libsystemd/sd-bus/bus-util.c @@ -1037,14 +1037,14 @@ static int map_basic(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_ return r; } -int bus_message_map_all_properties(sd_bus *bus, - sd_bus_message *m, - const struct bus_properties_map *map, - void *userdata) { +int bus_message_map_all_properties( + sd_bus_message *m, + const struct bus_properties_map *map, + void *userdata) { + _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; int r; - assert(bus); assert(m); assert(map); @@ -1080,9 +1080,9 @@ int bus_message_map_all_properties(sd_bus *bus, v = (uint8_t *)userdata + prop->offset; if (map[i].set) - r = prop->set(bus, member, m, &error, v); + r = prop->set(sd_bus_message_get_bus(m), member, m, &error, v); else - r = map_basic(bus, member, m, &error, v); + r = map_basic(sd_bus_message_get_bus(m), member, m, &error, v); if (r < 0) return r; @@ -1099,22 +1099,24 @@ int bus_message_map_all_properties(sd_bus *bus, if (r < 0) return r; } + if (r < 0) + return r; return sd_bus_message_exit_container(m); } -int bus_message_map_properties_changed(sd_bus *bus, - sd_bus_message *m, - const struct bus_properties_map *map, - void *userdata) { +int bus_message_map_properties_changed( + sd_bus_message *m, + const struct bus_properties_map *map, + void *userdata) { + const char *member; int r, invalidated, i; - assert(bus); assert(m); assert(map); - r = bus_message_map_all_properties(bus, m, map, userdata); + r = bus_message_map_all_properties(m, map, userdata); if (r < 0) return r; @@ -1129,6 +1131,8 @@ int bus_message_map_properties_changed(sd_bus *bus, ++invalidated; break; } + if (r < 0) + return r; r = sd_bus_message_exit_container(m); if (r < 0) @@ -1137,11 +1141,13 @@ int bus_message_map_properties_changed(sd_bus *bus, return invalidated; } -int bus_map_all_properties(sd_bus *bus, - const char *destination, - const char *path, - const struct bus_properties_map *map, - void *userdata) { +int bus_map_all_properties( + sd_bus *bus, + const char *destination, + const char *path, + const struct bus_properties_map *map, + void *userdata) { + _cleanup_bus_message_unref_ sd_bus_message *m = NULL; _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; int r; @@ -1163,7 +1169,7 @@ int bus_map_all_properties(sd_bus *bus, if (r < 0) return r; - return bus_message_map_all_properties(bus, m, map, userdata); + return bus_message_map_all_properties(m, map, userdata); } int bus_open_transport(BusTransport transport, const char *host, bool user, sd_bus **bus) { diff --git a/src/libsystemd/sd-bus/bus-util.h b/src/libsystemd/sd-bus/bus-util.h index 0f7a3b25b5..d3a18e2d94 100644 --- a/src/libsystemd/sd-bus/bus-util.h +++ b/src/libsystemd/sd-bus/bus-util.h @@ -45,19 +45,9 @@ struct bus_properties_map { int bus_map_id128(sd_bus *bus, const char *member, sd_bus_message *m, sd_bus_error *error, void *userdata); -int bus_message_map_all_properties(sd_bus *bus, - sd_bus_message *m, - const struct bus_properties_map *map, - void *userdata); -int bus_message_map_properties_changed(sd_bus *bus, - sd_bus_message *m, - const struct bus_properties_map *map, - void *userdata); -int bus_map_all_properties(sd_bus *bus, - const char *destination, - const char *path, - const struct bus_properties_map *map, - void *userdata); +int bus_message_map_all_properties(sd_bus_message *m, const struct bus_properties_map *map, void *userdata); +int bus_message_map_properties_changed(sd_bus_message *m, const struct bus_properties_map *map, void *userdata); +int bus_map_all_properties(sd_bus *bus, const char *destination, const char *path, const struct bus_properties_map *map, void *userdata); int bus_async_unregister_and_exit(sd_event *e, sd_bus *bus, const char *name); |