803fb7
From 1b84db099fc619719026679236a9db0199fd129a Mon Sep 17 00:00:00 2001
803fb7
From: Lennart Poettering <lennart@poettering.net>
803fb7
Date: Tue, 19 May 2015 00:24:27 +0200
803fb7
Subject: [PATCH] journalctl: rename boot_id_t to BootId
803fb7
803fb7
So far we tried to reserve the _t suffix to types we use like a value in
803fb7
contrast to types we use as objects, hence let's do this in journalctl
803fb7
too.
803fb7
803fb7
Cherry-picked from: 45bc27b621c51b9d0e0229835deb6d188bcd417b
803fb7
Related: #1318994
803fb7
---
803fb7
 src/journal/journalctl.c | 42 +++++++++++++++++++++++-------------------
803fb7
 1 file changed, 23 insertions(+), 19 deletions(-)
803fb7
803fb7
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
803fb7
index 92ee3fb27..e84dd4c9d 100644
803fb7
--- a/src/journal/journalctl.c
803fb7
+++ b/src/journal/journalctl.c
803fb7
@@ -128,12 +128,12 @@ static enum {
803fb7
         ACTION_VACUUM,
803fb7
 } arg_action = ACTION_SHOW;
803fb7
 
803fb7
-typedef struct boot_id_t {
803fb7
+typedef struct BootId {
803fb7
         sd_id128_t id;
803fb7
         uint64_t first;
803fb7
         uint64_t last;
803fb7
-        LIST_FIELDS(struct boot_id_t, boot_list);
803fb7
-} boot_id_t;
803fb7
+        LIST_FIELDS(struct BootId, boot_list);
803fb7
+} BootId;
803fb7
 
803fb7
 static int add_matches_for_device(sd_journal *j, const char *devpath) {
803fb7
         int r;
803fb7
@@ -934,13 +934,15 @@ static int add_matches(sd_journal *j, char **args) {
803fb7
         return 0;
803fb7
 }
803fb7
 
803fb7
-static int discover_next_boot(sd_journal *j,
803fb7
-                              boot_id_t **boot,
803fb7
-                              bool advance_older,
803fb7
-                              bool read_realtime) {
803fb7
+static int discover_next_boot(
803fb7
+                sd_journal *j,
803fb7
+                BootId **boot,
803fb7
+                bool advance_older,
803fb7
+                bool read_realtime) {
803fb7
+
803fb7
         int r;
803fb7
         char match[9+32+1] = "_BOOT_ID=";
803fb7
-        _cleanup_free_ boot_id_t *next_boot = NULL;
803fb7
+        _cleanup_free_ BootId *next_boot = NULL;
803fb7
 
803fb7
         assert(j);
803fb7
         assert(boot);
803fb7
@@ -965,7 +967,7 @@ static int discover_next_boot(sd_journal *j,
803fb7
         else if (r == 0)
803fb7
                 return 0; /* End of journal, yay. */
803fb7
 
803fb7
-        next_boot = new0(boot_id_t, 1);
803fb7
+        next_boot = new0(BootId, 1);
803fb7
         if (!next_boot)
803fb7
                 return log_oom();
803fb7
 
803fb7
@@ -1012,13 +1014,15 @@ static int discover_next_boot(sd_journal *j,
803fb7
         return 0;
803fb7
 }
803fb7
 
803fb7
-static int get_boots(sd_journal *j,
803fb7
-                     boot_id_t **boots,
803fb7
-                     boot_id_t *query_ref_boot,
803fb7
-                     int ref_boot_offset) {
803fb7
+static int get_boots(
803fb7
+                sd_journal *j,
803fb7
+                BootId **boots,
803fb7
+                BootId *query_ref_boot,
803fb7
+                int ref_boot_offset) {
803fb7
+
803fb7
         bool skip_once;
803fb7
         int r, count = 0;
803fb7
-        boot_id_t *head = NULL, *tail = NULL;
803fb7
+        BootId *head = NULL, *tail = NULL;
803fb7
         const bool advance_older = query_ref_boot && ref_boot_offset <= 0;
803fb7
 
803fb7
         assert(j);
803fb7
@@ -1073,12 +1077,12 @@ static int get_boots(sd_journal *j,
803fb7
                 /* No sd_journal_next/previous here. */
803fb7
         }
803fb7
 
803fb7
-        while (true) {
803fb7
-                _cleanup_free_ boot_id_t *current = NULL;
803fb7
+        for (;;) {
803fb7
+                _cleanup_free_ BootId *current = NULL;
803fb7
 
803fb7
                 r = discover_next_boot(j, &current, advance_older, !query_ref_boot);
803fb7
                 if (r < 0) {
803fb7
-                        boot_id_t *id, *id_next;
803fb7
+                        BootId *id, *id_next;
803fb7
                         LIST_FOREACH_SAFE(boot_list, id, id_next, head)
803fb7
                                 free(id);
803fb7
                         return r;
803fb7
@@ -1116,7 +1120,7 @@ finish:
803fb7
 
803fb7
 static int list_boots(sd_journal *j) {
803fb7
         int w, i, count;
803fb7
-        boot_id_t *id, *id_next, *all_ids;
803fb7
+        BootId *id, *id_next, *all_ids;
803fb7
 
803fb7
         assert(j);
803fb7
 
803fb7
@@ -1148,7 +1152,7 @@ static int list_boots(sd_journal *j) {
803fb7
 static int add_boot(sd_journal *j) {
803fb7
         char match[9+32+1] = "_BOOT_ID=";
803fb7
         int r;
803fb7
-        boot_id_t ref_boot_id = {};
803fb7
+        BootId ref_boot_id = {};
803fb7
 
803fb7
         assert(j);
803fb7