summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-25 16:37:09 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-25 16:37:09 +0200
commitd1bf9dc9631de75c4e1fd062ac5351abebfd9592 (patch)
treeb4090e515b884baa6ecd73e9a7462cf488f15f05
parentd4723fb5016b6679b3ed254be3832d88804a9f87 (diff)
journalctl: simplify discover_next_boot() a bit
Drop the "read_realtime" parameter. Getting the realtime timestamp from an entry is cheap, as it is a normal header field, hence let's just get this unconditionally, and simplify our code a bit.
-rw-r--r--src/journal/journalctl.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
index fbb147d1f7..97310e287c 100644
--- a/src/journal/journalctl.c
+++ b/src/journal/journalctl.c
@@ -991,8 +991,7 @@ static void boot_id_free_all(BootId *l) {
static int discover_next_boot(
sd_journal *j,
BootId **boot,
- bool advance_older,
- bool read_realtime) {
+ bool advance_older) {
int r;
char match[9+32+1] = "_BOOT_ID=";
@@ -1029,11 +1028,9 @@ static int discover_next_boot(
if (r < 0)
return r;
- if (read_realtime) {
- r = sd_journal_get_realtime_usec(j, &next_boot->first);
- if (r < 0)
- return r;
- }
+ r = sd_journal_get_realtime_usec(j, &next_boot->first);
+ if (r < 0)
+ return r;
/* Now seek to the last occurrence of this boot ID. */
sd_id128_to_string(next_boot->id, match + 9);
@@ -1057,11 +1054,9 @@ static int discover_next_boot(
else if (r == 0)
return -ENODATA; /* This shouldn't happen. We just came from this very boot ID. */
- if (read_realtime) {
- r = sd_journal_get_realtime_usec(j, &next_boot->last);
- if (r < 0)
- return r;
- }
+ r = sd_journal_get_realtime_usec(j, &next_boot->last);
+ if (r < 0)
+ return r;
*boot = next_boot;
next_boot = NULL;
@@ -1144,7 +1139,7 @@ static int get_boots(
for (;;) {
_cleanup_free_ BootId *current = NULL;
- r = discover_next_boot(j, &current, advance_older, !query_ref_boot);
+ r = discover_next_boot(j, &current, advance_older);
if (r < 0) {
boot_id_free_all(head);
return r;