static void *vtable_method_convert_userdata(const sd_bus_vtable *p, void *u) {
assert(p);
- if (!u)
+ if (!u || FLAGS_SET(p->flags, SD_BUS_VTABLE_ABSOLUTE_OFFSET))
return SIZE_TO_PTR(p->x.method.offset); /* don't add offset on NULL, to make ubsan happy */
return (uint8_t*) u + p->x.method.offset;
static void *vtable_property_convert_userdata(const sd_bus_vtable *p, void *u) {
assert(p);
- if (!u)
+ if (!u || FLAGS_SET(p->flags, SD_BUS_VTABLE_ABSOLUTE_OFFSET))
return SIZE_TO_PTR(p->x.property.offset); /* as above */
return (uint8_t*) u + p->x.property.offset;
if (r < 0)
return r;
- found_interface = !iface ||
- streq(iface, "org.freedesktop.DBus.Properties") ||
- streq(iface, "org.freedesktop.DBus.Peer") ||
- streq(iface, "org.freedesktop.DBus.Introspectable");
+ found_interface = !iface || STR_IN_SET(iface,
+ "org.freedesktop.DBus.Properties",
+ "org.freedesktop.DBus.Peer",
+ "org.freedesktop.DBus.Introspectable");
LIST_FOREACH(vtables, c, first) {
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_error *error) {
_cleanup_set_free_free_ Set *s = NULL;
- const char *previous_interface = NULL;
_cleanup_(introspect_free) struct introspect intro = {};
struct node_vtable *c;
bool empty;
if (c->vtable[0].flags & SD_BUS_VTABLE_HIDDEN)
continue;
- if (!streq_ptr(previous_interface, c->interface)) {
- if (previous_interface)
- fputs(" </interface>\n", intro.f);
-
- fprintf(intro.f, " <interface name=\"%s\">\n", c->interface);
- }
-
- r = introspect_write_interface(&intro, c->vtable);
+ r = introspect_write_interface(&intro, c->interface, c->vtable);
if (r < 0)
return r;
-
- previous_interface = c->interface;
}
- if (previous_interface)
- fputs(" </interface>\n", intro.f);
-
if (empty) {
/* Nothing?, let's see if we exist at all, and if not
* refuse to do anything */
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
_cleanup_(sd_bus_message_unrefp) sd_bus_message *reply = NULL;
_cleanup_set_free_free_ Set *s = NULL;
- Iterator i;
char *path;
int r;
if (r < 0)
return r;
- SET_FOREACH(path, s, i) {
+ SET_FOREACH(path, s) {
r = object_manager_serialize_path_and_fallbacks(bus, reply, path, &error);
if (r < 0)
return bus_maybe_reply_error(m, r, &error);