]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sd-journal: shorten code a bit
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 27 Jun 2022 02:28:36 +0000 (11:28 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 28 Jun 2022 18:42:37 +0000 (03:42 +0900)
src/libsystemd/sd-journal/journal-file.c

index f268abede7f3a31966dc77b943e2c5f294530256..517b01543f0117f894e3d079f864d00da731bbae 100644 (file)
@@ -799,7 +799,6 @@ static int journal_file_check_object(JournalFile *f, uint64_t offset, Object *o)
 
 int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset, Object **ret) {
         int r;
-        void *t;
         Object *o;
         uint64_t s;
 
@@ -817,11 +816,10 @@ int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset
                                        "Attempt to move to object located in file header: %" PRIu64,
                                        offset);
 
-        r = journal_file_move_to(f, type, false, offset, sizeof(ObjectHeader), &t);
+        r = journal_file_move_to(f, type, false, offset, sizeof(ObjectHeader), (void**) &o);
         if (r < 0)
                 return r;
 
-        o = (Object*) t;
         s = le64toh(READ_NOW(o->object.size));
 
         if (s == 0)
@@ -848,12 +846,10 @@ int journal_file_move_to_object(JournalFile *f, ObjectType type, uint64_t offset
                                        "Attempt to move to object of unexpected type: %" PRIu64,
                                        offset);
 
-        r = journal_file_move_to(f, type, false, offset, s, &t);
+        r = journal_file_move_to(f, type, false, offset, s, (void**) &o);
         if (r < 0)
                 return r;
 
-        o = (Object*) t;
-
         r = journal_file_check_object(f, offset, o);
         if (r < 0)
                 return r;
@@ -976,7 +972,6 @@ int journal_file_append_object(
         int r;
         uint64_t p;
         Object *o;
-        void *t;
 
         assert(f);
         assert(f->header);
@@ -995,11 +990,10 @@ int journal_file_append_object(
         if (r < 0)
                 return r;
 
-        r = journal_file_move_to(f, type, false, p, size, &t);
+        r = journal_file_move_to(f, type, false, p, size, (void**) &o);
         if (r < 0)
                 return r;
 
-        o = (Object*) t;
         o->object = (ObjectHeader) {
                 .type = type,
                 .size = htole64(size),