]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
dhcp-client: use structured initializer at one more place
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 13 Nov 2018 04:49:12 +0000 (13:49 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 16 Nov 2018 13:57:42 +0000 (22:57 +0900)
src/libsystemd-network/sd-dhcp-client.c

index c538362488fcd6633e63ef9fc9764d4c2901f7ea..ee2b80018c66b5521d02f4b12ad4580fe2802678 100644 (file)
@@ -1982,19 +1982,20 @@ int sd_dhcp_client_new(sd_dhcp_client **ret, int anonymize) {
 
         assert_return(ret, -EINVAL);
 
-        client = new0(sd_dhcp_client, 1);
+        client = new(sd_dhcp_client, 1);
         if (!client)
                 return -ENOMEM;
 
-        client->n_ref = 1;
-        client->state = DHCP_STATE_INIT;
-        client->ifindex = -1;
-        client->fd = -1;
-        client->attempt = 1;
-        client->mtu = DHCP_DEFAULT_MIN_SIZE;
-        client->port = DHCP_PORT_CLIENT;
-
-        client->anonymize = !!anonymize;
+        *client = (sd_dhcp_client) {
+                .n_ref = 1,
+                .state = DHCP_STATE_INIT,
+                .ifindex = -1,
+                .fd = -1,
+                .attempt = 1,
+                .mtu = DHCP_DEFAULT_MIN_SIZE,
+                .port = DHCP_PORT_CLIENT,
+                .anonymize = !!anonymize,
+        };
         /* NOTE: this could be moved to a function. */
         if (anonymize) {
                 client->req_opts_size = ELEMENTSOF(default_req_opts_anonymize);