sd-netlink: use structured initializer
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 23 Jul 2019 06:47:33 +0000 (15:47 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 14 Oct 2019 16:57:19 +0000 (01:57 +0900)
src/libsystemd/sd-netlink/netlink-message.c

index 58ec1ef..e1395c6 100644 (file)
@@ -31,13 +31,15 @@ int message_new_empty(sd_netlink *rtnl, sd_netlink_message **ret) {
            buses and their queued messages. See sd-bus.
          */
 
-        m = new0(sd_netlink_message, 1);
+        m = new(sd_netlink_message, 1);
         if (!m)
                 return -ENOMEM;
 
-        m->n_ref = 1;
-        m->protocol = rtnl->protocol;
-        m->sealed = false;
+        *m = (sd_netlink_message) {
+                .n_ref = 1,
+                .protocol = rtnl->protocol,
+                .sealed = false,
+        };
 
         *ret = m;