]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: Use more structured initialization
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 11 Nov 2021 15:35:28 +0000 (15:35 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 19 Nov 2021 17:06:57 +0000 (17:06 +0000)
src/libsystemd/sd-journal/journal-file.c

index 729c734156ac5f4448246370ba4b9119ee999854..f8cbc68a244354295e5a32cb3250e779241018f0 100644 (file)
@@ -2170,8 +2170,10 @@ int journal_file_append_entry(
                 else
                         xor_hash ^= le64toh(o->data.hash);
 
-                items[i].object_offset = htole64(p);
-                items[i].hash = o->data.hash;
+                items[i] = (EntryItem) {
+                        .object_offset = htole64(p),
+                        .hash = o->data.hash,
+                };
         }
 
         /* Order by the position on disk, in order to improve seek
@@ -3867,8 +3869,10 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
         if (!to->writable)
                 return -EPERM;
 
-        ts.monotonic = le64toh(o->entry.monotonic);
-        ts.realtime = le64toh(o->entry.realtime);
+        ts = (dual_timestamp) {
+                .monotonic = le64toh(o->entry.monotonic),
+                .realtime = le64toh(o->entry.realtime),
+        };
         boot_id = &o->entry.boot_id;
 
         n = journal_file_entry_n_items(o);
@@ -3931,8 +3935,10 @@ int journal_file_copy_entry(JournalFile *from, JournalFile *to, Object *o, uint6
                 else
                         xor_hash ^= le64toh(u->data.hash);
 
-                items[i].object_offset = htole64(h);
-                items[i].hash = u->data.hash;
+                items[i] = (EntryItem) {
+                        .object_offset = htole64(h),
+                        .hash = u->data.hash,
+                };
 
                 r = journal_file_move_to_object(from, OBJECT_ENTRY, p, &o);
                 if (r < 0)