machine-image: use structured initialization

This commit is contained in:
Lennart Poettering 2021-01-08 16:56:37 +01:00
parent 8c8932a741
commit c21087014e
1 changed files with 12 additions and 8 deletions

View File

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