]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-bus-match: small modernization
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 4 Mar 2021 20:25:14 +0000 (21:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 6 Mar 2021 08:32:18 +0000 (09:32 +0100)
src/libsystemd/sd-bus/test-bus-match.c

index 701476ed03472c8dc1a7acf9e01689f0f1cba6a1..7a20a6c3c432ac6693d66216f56f5ef352e8f783 100644 (file)
@@ -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;