]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal: as per coding style don't clobber return parameters in sd_journal_get_cutoff...
authorLennart Poettering <lennart@poettering.net>
Tue, 8 Jun 2021 20:20:16 +0000 (22:20 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 9 Jun 2021 07:34:50 +0000 (09:34 +0200)
src/libsystemd/sd-journal/sd-journal.c

index aab620c96ee6de43ead4baf28702ceb759af8bc0..4d101f02c8ed6991d530ec7cf33d14e22326ff0a 100644 (file)
@@ -2783,20 +2783,25 @@ _public_ int sd_journal_get_cutoff_realtime_usec(sd_journal *j, uint64_t *from,
         return first ? 0 : 1;
 }
 
-_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
-        JournalFile *f;
+_public_ int sd_journal_get_cutoff_monotonic_usec(
+                sd_journal *j,
+                sd_id128_t boot_id,
+                uint64_t *ret_from,
+                uint64_t *ret_to) {
+
+        uint64_t from = UINT64_MAX, to = UINT64_MAX;
         bool found = false;
+        JournalFile *f;
         int r;
 
         assert_return(j, -EINVAL);
         assert_return(!journal_pid_changed(j), -ECHILD);
-        assert_return(from || to, -EINVAL);
-        assert_return(from != to, -EINVAL);
+        assert_return(ret_from != ret_to, -EINVAL);
 
         ORDERED_HASHMAP_FOREACH(f, j->files) {
-                usec_t fr, t;
+                usec_t ff, tt;
 
-                r = journal_file_get_cutoff_monotonic_usec(f, boot_id, &fr, &t);
+                r = journal_file_get_cutoff_monotonic_usec(f, boot_id, &ff, &tt);
                 if (r == -ENOENT)
                         continue;
                 if (r < 0)
@@ -2805,19 +2810,20 @@ _public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot
                         continue;
 
                 if (found) {
-                        if (from)
-                                *from = MIN(fr, *from);
-                        if (to)
-                                *to = MAX(t, *to);
+                        from = MIN(ff, from);
+                        to = MAX(tt, to);
                 } else {
-                        if (from)
-                                *from = fr;
-                        if (to)
-                                *to = t;
+                        from = ff;
+                        to = tt;
                         found = true;
                 }
         }
 
+        if (ret_from)
+                *ret_from = from;
+        if (ret_to)
+                *ret_to = to;
+
         return found;
 }