]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine-image: use structured initialization
authorLennart Poettering <lennart@poettering.net>
Fri, 8 Jan 2021 15:56:37 +0000 (16:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Sat, 9 Jan 2021 14:48:33 +0000 (15:48 +0100)
src/shared/machine-image.c

index 0b148c067af6897699dc3ce7e6d8d42347f787fa..366abd8971995004c4b95441a4d3f8cf46192332 100644 (file)
@@ -129,17 +129,21 @@ static int image_new(
         assert(filename);
         assert(ret);
 
-        i = new0(Image, 1);
+        i = new(Image, 1);
         if (!i)
                 return -ENOMEM;
 
-        i->n_ref = 1;
-        i->type = t;
-        i->read_only = read_only;
-        i->crtime = crtime;
-        i->mtime = mtime;
-        i->usage = i->usage_exclusive = (uint64_t) -1;
-        i->limit = i->limit_exclusive = (uint64_t) -1;
+        *i = (Image) {
+                .n_ref = 1,
+                .type = t,
+                .read_only = read_only,
+                .crtime = crtime,
+                .mtime = mtime,
+                .usage = UINT64_MAX,
+                .usage_exclusive = UINT64_MAX,
+                .limit = UINT64_MAX,
+                .limit_exclusive = UINT64_MAX,
+        };
 
         i->name = strdup(pretty);
         if (!i->name)