diff options
author | Alan Jenkins <alan.christopher.jenkins@gmail.com> | 2017-09-16 13:32:59 +0200 |
---|---|---|
committer | Alan Jenkins <alan.christopher.jenkins@gmail.com> | 2017-09-17 18:55:01 +0200 |
commit | 00590f8268846f717a77e5f0f8bc3e2a5740855e (patch) | |
tree | 1fd9e5de8c07153870e60f281cb167eb6dc4b8e3 | |
parent | sd-bus: fix response for GetAll on non-existent objects (diff) | |
download | systemd-00590f8268846f717a77e5f0f8bc3e2a5740855e.tar.xz systemd-00590f8268846f717a77e5f0f8bc3e2a5740855e.zip |
sd-bus: style nitpick node_vtable_get_userdata()
It's confusing to use a single void* to store data with two different
types, i.e. a userdata value which is safe to pass to ->find(), and a
userdata value which identifies the found object.
Name the latter `found_u`. This naming treats (!c->find) as a degenerate
case. (I.e. at that point, we know the object has already been found :).
-rw-r--r-- | src/libsystemd/sd-bus/bus-objects.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/libsystemd/sd-bus/bus-objects.c b/src/libsystemd/sd-bus/bus-objects.c index a4c0cc5db1..dcd929b13b 100644 --- a/src/libsystemd/sd-bus/bus-objects.c +++ b/src/libsystemd/sd-bus/bus-objects.c @@ -38,7 +38,7 @@ static int node_vtable_get_userdata( sd_bus_error *error) { sd_bus_slot *s; - void *u; + void *u, *found_u; int r; assert(bus); @@ -50,7 +50,7 @@ static int node_vtable_get_userdata( if (c->find) { bus->current_slot = sd_bus_slot_ref(s); bus->current_userdata = u; - r = c->find(bus, path, c->interface, u, &u, error); + r = c->find(bus, path, c->interface, u, &found_u, error); bus->current_userdata = NULL; bus->current_slot = sd_bus_slot_unref(s); @@ -60,10 +60,11 @@ static int node_vtable_get_userdata( return -sd_bus_error_get_errno(error); if (r == 0) return r; - } + } else + found_u = u; if (userdata) - *userdata = u; + *userdata = found_u; return 1; } |