From: Lennart Poettering Date: Thu, 25 Oct 2018 11:53:07 +0000 (+0200) Subject: tmpfiles: why memset() and memcpy() if we have '=' and structured initialization? X-Git-Tag: v240~265^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ab7529d45ee9c780f4fd7a974652043c4b504ce;p=thirdparty%2Fsystemd.git tmpfiles: why memset() and memcpy() if we have '=' and structured initialization? --- diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index 945c5df9919..b1e85e22329 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -2801,12 +2801,12 @@ static int parse_line(const char *fname, unsigned line, const char *buffer, bool if (!GREEDY_REALLOC(existing->items, existing->allocated, existing->n_items + 1)) return log_oom(); - memcpy(existing->items + existing->n_items++, &i, sizeof(i)); + existing->items[existing->n_items++] = i; + i = (struct Item) {}; /* Sort item array, to enforce stable ordering of application */ typesafe_qsort(existing->items, existing->n_items, item_compare); - zero(i); return 0; }