]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-device: use structured initializers
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 27 Aug 2018 05:07:01 +0000 (14:07 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 27 Aug 2018 20:09:40 +0000 (05:09 +0900)
src/libsystemd/sd-device/device-enumerator.c
src/libsystemd/sd-device/sd-device.c

index 7e0d313a08e1753172b1a21998203b4747d40e4b..9f7783e86cd527df890d303f0bae91b2a73b7ee2 100644 (file)
@@ -45,12 +45,14 @@ _public_ int sd_device_enumerator_new(sd_device_enumerator **ret) {
 
         assert(ret);
 
-        enumerator = new0(sd_device_enumerator, 1);
+        enumerator = new(sd_device_enumerator, 1);
         if (!enumerator)
                 return -ENOMEM;
 
-        enumerator->n_ref = 1;
-        enumerator->type = _DEVICE_ENUMERATION_TYPE_INVALID;
+        *enumerator = (sd_device_enumerator) {
+                .n_ref = 1,
+                .type = _DEVICE_ENUMERATION_TYPE_INVALID,
+        };
 
         *ret = TAKE_PTR(enumerator);
 
index 1d3999acbdea387e26981588610dffd7b2764a8f..c61e98fe7264238557c52940fcb06dd2da525236 100644 (file)
@@ -31,15 +31,16 @@ int device_new_aux(sd_device **ret) {
 
         assert(ret);
 
-        device = new0(sd_device, 1);
+        device = new(sd_device, 1);
         if (!device)
                 return -ENOMEM;
 
-        device->n_ref = 1;
-        device->watch_handle = -1;
+        *device = (sd_device) {
+                .n_ref = 1,
+                .watch_handle = -1,
+        };
 
         *ret = device;
-
         return 0;
 }