resolve: use structured initialization and use new() instead of new0()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Jul 2018 08:43:09 +0000 (17:43 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 26 Jul 2018 08:45:34 +0000 (17:45 +0900)
src/resolve/resolved-etc-hosts.c

index 0859166..10e2b7f 100644 (file)
@@ -112,13 +112,15 @@ static int add_item(Manager *m, int family, const union in_addr_union *address,
                         if (r < 0)
                                 return log_oom();
 
-                        item = new0(EtcHostsItem, 1);
+                        item = new(EtcHostsItem, 1);
                         if (!item)
                                 return log_oom();
 
-                        item->family = family;
-                        item->address = *address;
-                        item->names = names;
+                        *item = (EtcHostsItem) {
+                                .family = family,
+                                .address = *address,
+                                .names = names,
+                        };
 
                         r = set_put(m->etc_hosts_by_address, item);
                         if (r < 0) {