From dd2e9b7658ba2da021ec1a7a053375f7ba698361 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 4 Mar 2021 21:25:14 +0100 Subject: [PATCH] test-bus-match: small modernization --- src/libsystemd/sd-bus/test-bus-match.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/libsystemd/sd-bus/test-bus-match.c b/src/libsystemd/sd-bus/test-bus-match.c index 701476ed03..7a20a6c3c4 100644 --- a/src/libsystemd/sd-bus/test-bus-match.c +++ b/src/libsystemd/sd-bus/test-bus-match.c @@ -37,13 +37,12 @@ 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 = NULL; - unsigned n_components = 0; + struct bus_match_component *components; + unsigned n_components; sd_bus_slot *s; int r; s = slots + value; - zero(*s); r = bus_match_parse(match, &components, &n_components); if (r < 0) @@ -74,8 +73,7 @@ int main(int argc, char *argv[]) { _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; _cleanup_(sd_bus_flush_close_unrefp) sd_bus *bus = NULL; - enum bus_match_node_type i; - sd_bus_slot slots[19]; + sd_bus_slot slots[19] = {}; int r; test_setup_logging(LOG_INFO); @@ -124,7 +122,7 @@ int main(int argc, char *argv[]) { assert_se(bus_match_run(NULL, &root, m) == 0); assert_se(mask_contains((unsigned[]) { 9, 5, 10, 12, 14, 7, 15, 16, 17 }, 9)); - for (i = 0; i < _BUS_MATCH_NODE_TYPE_MAX; i++) { + for (enum bus_match_node_type i = 0; i < _BUS_MATCH_NODE_TYPE_MAX; i++) { char buf[32]; const char *x; -- 2.25.1