From: Lennart Poettering Date: Wed, 13 Oct 2021 10:08:20 +0000 (+0200) Subject: journal: drop unnecessary +1 in newa() expression X-Git-Tag: v250-rc1~504^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5222651ecc6f46391e5e0d9cf19793bfe65b0ec8;p=thirdparty%2Fsystemd.git journal: drop unnecessary +1 in newa() expression newa() does this internally anyway, no need to do this explicitly. --- diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index d5ceba2f8fb..7c88c6614dc 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -2146,8 +2146,7 @@ int journal_file_append_entry( return r; #endif - /* alloca() can't take 0, hence let's allocate at least one */ - items = newa(EntryItem, MAX(1u, n_iovec)); + items = newa(EntryItem, n_iovec); for (unsigned i = 0; i < n_iovec; i++) { uint64_t p; @@ -3873,8 +3872,7 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6 boot_id = &o->entry.boot_id; n = journal_file_entry_n_items(o); - /* alloca() can't take 0, hence let's allocate at least one */ - items = newa(EntryItem, MAX(1u, n)); + items = newa(EntryItem, n); for (uint64_t i = 0; i < n; i++) { uint64_t l, h;