case BUS_MATCH_MEMBER:
case BUS_MATCH_PATH:
case BUS_MATCH_ARG ... BUS_MATCH_ARG_LAST:
- return streq(node->value.str, value_str);
+ return streq_ptr(node->value.str, value_str);
case BUS_MATCH_ARG_NAMESPACE ... BUS_MATCH_ARG_NAMESPACE_LAST:
return namespace_simple_pattern(node->value.str, value_str);
int bus_match_run(
sd_bus *bus,
struct bus_match_node *node,
- int ret,
sd_bus_message *m) {
* we won't call any. The children of the root node
* are compares or leaves, they will automatically
* call their siblings. */
- return bus_match_run(bus, node->child, ret, m);
+ return bus_match_run(bus, node->child, m);
case BUS_MATCH_VALUE:
* automatically call their siblings */
assert(node->child);
- return bus_match_run(bus, node->child, ret, m);
+ return bus_match_run(bus, node->child, m);
case BUS_MATCH_LEAF:
node->leaf.last_iteration = bus->iteration_counter;
}
+ r = sd_bus_message_rewind(m, true);
+ if (r < 0)
+ return r;
+
/* Run the callback. And then invoke siblings. */
assert(node->leaf.callback);
- r = node->leaf.callback(bus, ret, m, node->leaf.userdata);
+ r = node->leaf.callback(bus, m, node->leaf.userdata);
if (r != 0)
return r;
- return bus_match_run(bus, node->next, ret, m);
+ return bus_match_run(bus, node->next, m);
case BUS_MATCH_MESSAGE_TYPE:
test_u8 = m->header->type;
found = NULL;
if (found) {
- r = bus_match_run(bus, found, ret, m);
+ r = bus_match_run(bus, found, m);
if (r != 0)
return r;
}
if (!value_node_test(c, node->type, test_u8, test_str))
continue;
- r = bus_match_run(bus, c, ret, m);
+ r = bus_match_run(bus, c, m);
if (r != 0)
return r;
}
return 0;
/* And now, let's invoke our siblings */
- return bus_match_run(bus, node->next, ret, m);
+ return bus_match_run(bus, node->next, m);
}
static int bus_match_add_compare_value(
}
}
- if (!greedy_realloc((void**) &value, &value_allocated, j + 2)) {
+ if (!GREEDY_REALLOC(value, value_allocated, j + 2)) {
r = -ENOMEM;
goto fail;
}
} else
u = 0;
- if (!greedy_realloc((void**) &components, &components_allocated,
- (n_components + 1) * sizeof(struct match_component))) {
+ if (!GREEDY_REALLOC(components, components_allocated, n_components + 1)) {
r = -ENOMEM;
goto fail;
}