]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: use correct type for flags
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 19 Mar 2024 10:04:10 +0000 (19:04 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 26 Mar 2024 13:21:13 +0000 (22:21 +0900)
This also moves its declaration, as it is not changed in the loop.

src/journal/journalctl.c

index 19b4f076c1cf9c2595971a8f08ce9e2ef9f2c4cc..2d44e95e290926ac8bfa205a40aaab1cd13a45d0 100644 (file)
@@ -2088,8 +2088,16 @@ static int show(Context *c) {
 
         j = ASSERT_PTR(c->journal);
 
+        OutputFlags flags =
+                arg_all * OUTPUT_SHOW_ALL |
+                arg_full * OUTPUT_FULL_WIDTH |
+                colors_enabled() * OUTPUT_COLOR |
+                arg_catalog * OUTPUT_CATALOG |
+                arg_utc * OUTPUT_UTC |
+                arg_truncate_newline * OUTPUT_TRUNCATE_NEWLINE |
+                arg_no_hostname * OUTPUT_NO_HOSTNAME;
+
         while (arg_lines < 0 || n_shown < arg_lines || arg_follow) {
-                int flags;
                 size_t highlight[2] = {};
 
                 if (c->need_seek) {
@@ -2180,15 +2188,6 @@ static int show(Context *c) {
                         }
                 }
 
-                flags =
-                        arg_all * OUTPUT_SHOW_ALL |
-                        arg_full * OUTPUT_FULL_WIDTH |
-                        colors_enabled() * OUTPUT_COLOR |
-                        arg_catalog * OUTPUT_CATALOG |
-                        arg_utc * OUTPUT_UTC |
-                        arg_truncate_newline * OUTPUT_TRUNCATE_NEWLINE |
-                        arg_no_hostname * OUTPUT_NO_HOSTNAME;
-
                 r = show_journal_entry(stdout, j, arg_output, 0, flags,
                                        arg_output_fields, highlight, &c->ellipsized,
                                        &c->previous_ts_output, &c->previous_boot_id_output);