* we won't call any. The children of the root node
* are compares or leaves, they will automatically
* call their siblings. */
* we won't call any. The children of the root node
* are compares or leaves, they will automatically
* call their siblings. */
- assert(node->leaf.callback);
- r = node->leaf.callback(bus, ret, m, node->leaf.userdata);
- if (r != 0)
- return r;
+ if (node->leaf.callback) {
+ r = node->leaf.callback(bus, m, node->leaf.userdata);
+ if (r != 0)
+ return r;
+ }
if (!value_node_test(c, node->type, test_u8, test_str))
continue;
if (!value_node_test(c, node->type, test_u8, test_str))
continue;
struct bus_match_node *where,
sd_bus_message_handler_t callback,
void *userdata,
struct bus_match_node *where,
sd_bus_message_handler_t callback,
void *userdata,
- if (n == 8 && memcmp(k, "arg", 3) == 0 && memcmp(k + 4, "path", 4) == 0) {
+ if (n == 8 && startswith(k, "arg") && startswith(k + 4, "path")) {
- if (n == 9 && memcmp(k, "arg", 3) == 0 && memcmp(k + 5, "path", 4) == 0) {
+ if (n == 9 && startswith(k, "arg") && startswith(k + 5, "path")) {
- if (n == 13 && memcmp(k, "arg", 3) == 0 && memcmp(k + 4, "namespace", 9) == 0) {
+ if (n == 13 && startswith(k, "arg") && startswith(k + 4, "namespace")) {
- if (n == 14 && memcmp(k, "arg", 3) == 0 && memcmp(k + 5, "namespace", 9) == 0) {
+ if (n == 14 && startswith(k, "arg") && startswith(k + 5, "namespace")) {
size_t components_allocated = 0;
unsigned n_components = 0, i;
_cleanup_free_ char *value = NULL;
size_t components_allocated = 0;
unsigned n_components = 0, i;
_cleanup_free_ char *value = NULL;
- qsort(components, n_components, sizeof(struct match_component), match_component_compare);
+ qsort_safe(components, n_components, sizeof(struct bus_match_component), match_component_compare);
- r = bus_match_add_leaf(n, callback, userdata, &n);
+ r = bus_match_add_leaf(n, callback, userdata, cookie, &n);
gc[i] = n;
}
r = bus_match_find_leaf(n, callback, userdata, &n);
if (r <= 0)
gc[i] = n;
}
r = bus_match_find_leaf(n, callback, userdata, &n);
if (r <= 0)