1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

journal: drop unnecessary +1 in newa() expression

newa() does this internally anyway, no need to do this explicitly.
This commit is contained in:
Lennart Poettering 2021-10-13 12:08:20 +02:00
parent 698cec65c4
commit 5222651ecc

View File

@ -2146,8 +2146,7 @@ int journal_file_append_entry(
return r; return r;
#endif #endif
/* alloca() can't take 0, hence let's allocate at least one */ items = newa(EntryItem, n_iovec);
items = newa(EntryItem, MAX(1u, n_iovec));
for (unsigned i = 0; i < n_iovec; i++) { for (unsigned i = 0; i < n_iovec; i++) {
uint64_t p; 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; boot_id = &o->entry.boot_id;
n = journal_file_entry_n_items(o); n = journal_file_entry_n_items(o);
/* alloca() can't take 0, hence let's allocate at least one */ items = newa(EntryItem, n);
items = newa(EntryItem, MAX(1u, n));
for (uint64_t i = 0; i < n; i++) { for (uint64_t i = 0; i < n; i++) {
uint64_t l, h; uint64_t l, h;