From: Alan Jenkins Date: Sat, 16 Sep 2017 11:32:59 +0000 (+0100) Subject: sd-bus: style nitpick node_vtable_get_userdata() X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=076cfbaf21c2eb087a09cc90f41008660fcbcf93;p=elogind.git 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 :). --- diff --git a/src/libelogind/sd-bus/bus-objects.c b/src/libelogind/sd-bus/bus-objects.c index 0a58a8388..6966f73a1 100644 --- a/src/libelogind/sd-bus/bus-objects.c +++ b/src/libelogind/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; }