diff options
author | Lennart Poettering <lennart@poettering.net> | 2023-02-22 23:12:53 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2023-02-23 11:43:43 +0900 |
commit | 8c2d0d3af46ba1f371ef73e06cbb460711187d2b (patch) | |
tree | e865a3b5daf04fb2bbbf7dcdc021396d8c104f22 /src/libsystemd/sd-bus/test-bus-match.c | |
parent | ff3f1464ec2dd40c9d8eb92e1474cb4d1c8c676b (diff) | |
download | systemd-8c2d0d3af46ba1f371ef73e06cbb460711187d2b.tar.gz |
tree-wide: port various things over to CLEANUP_ARRAY()
Diffstat (limited to 'src/libsystemd/sd-bus/test-bus-match.c')
-rw-r--r-- | src/libsystemd/sd-bus/test-bus-match.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c index 7a20a6c3c4..2d7755711e 100644 --- a/src/libsystemd/sd-bus/test-bus-match.c +++ b/src/libsystemd/sd-bus/test-bus-match.c @@ -38,7 +38,7 @@ static bool mask_contains(unsigned a[], unsigned n) { static int match_add(sd_bus_slot *slots, struct bus_match_node *root, const char *match, int value) { struct bus_match_component *components; - unsigned n_components; + size_t n_components; sd_bus_slot *s; int r; @@ -48,22 +48,22 @@ static int match_add(sd_bus_slot *slots, struct bus_match_node *root, const char if (r < 0) return r; + CLEANUP_ARRAY(components, n_components, bus_match_parse_free); + s->userdata = INT_TO_PTR(value); s->match_callback.callback = filter; - r = bus_match_add(root, components, n_components, &s->match_callback); - bus_match_parse_free(components, n_components); - - return r; + return bus_match_add(root, components, n_components, &s->match_callback); } static void test_match_scope(const char *match, enum bus_match_scope scope) { struct bus_match_component *components = NULL; - unsigned n_components = 0; + size_t n_components = 0; + + CLEANUP_ARRAY(components, n_components, bus_match_parse_free); assert_se(bus_match_parse(match, &components, &n_components) >= 0); assert_se(bus_match_get_scope(components, n_components) == scope); - bus_match_parse_free(components, n_components); } int main(int argc, char *argv[]) { |