From: Lennart Poettering Date: Wed, 27 Nov 2019 11:08:39 +0000 (+0100) Subject: journal: use structured initialization X-Git-Tag: v245-rc1~41^2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f5435a14757fd6f96f3d1faaa010a4464fb4825;p=thirdparty%2Fsystemd.git journal: use structured initialization --- diff --git a/src/journal/sd-journal.c b/src/journal/sd-journal.c index 093eb6619e0..d2df5ee3b38 100644 --- a/src/journal/sd-journal.c +++ b/src/journal/sd-journal.c @@ -204,16 +204,17 @@ static bool same_field(const void *_a, size_t s, const void *_b, size_t t) { static Match *match_new(Match *p, MatchType t) { Match *m; - m = new0(Match, 1); + m = new(Match, 1); if (!m) return NULL; - m->type = t; + *m = (Match) { + .type = t, + .parent = p, + }; - if (p) { - m->parent = p; + if (p) LIST_PREPEND(matches, p->matches, m); - } return m; } @@ -1573,14 +1574,16 @@ static int add_directory(sd_journal *j, const char *prefix, const char *dirname) m = hashmap_get(j->directories_by_path, path); if (!m) { - m = new0(Directory, 1); + m = new(Directory, 1); if (!m) { r = -ENOMEM; goto fail; } - m->is_root = false; - m->path = path; + *m = (Directory) { + .is_root = false, + .path = path, + }; if (hashmap_put(j->directories_by_path, m->path, m) < 0) { free(m);