]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journalctl: drop some parentheses
authorZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Tue, 12 May 2026 12:05:01 +0000 (14:05 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@amutable.com>
Tue, 12 May 2026 13:29:51 +0000 (15:29 +0200)
src/journal/journalctl.c

index 2b4995714f53a22e0a5d22e5831750016c80c700..a48e28497d3a6fde94c13dedb23ad15ecf9fab9f 100644 (file)
@@ -527,55 +527,44 @@ static int parse_argv(int argc, char *argv[], char ***remaining_args) {
                         break;
 
                 OPTION('p', "priority", "RANGE", "Show entries within the specified priority range"): {
-                        const char *dots;
 
-                        dots = strstr(opts.arg, "..");
+                        const char *dots = strstr(opts.arg, "..");
                         if (dots) {
-                                _cleanup_free_ char *a = NULL;
-                                int from, to, i;
-
                                 /* a range */
-                                a = strndup(opts.arg, dots - opts.arg);
+                                _cleanup_free_ char *a = strndup(opts.arg, dots - opts.arg);
                                 if (!a)
                                         return log_oom();
 
-                                from = log_level_from_string(a);
-                                to = log_level_from_string(dots + 2);
+                                int from = log_level_from_string(a),
+                                      to = log_level_from_string(dots + 2);
 
                                 if (from < 0 || to < 0)
                                         return log_error_errno(from < 0 ? from : to,
                                                                "Failed to parse log level range %s", opts.arg);
 
                                 arg_priorities = 0;
-
-                                if (from < to) {
-                                        for (i = from; i <= to; i++)
+                                if (from < to)
+                                        for (int i = from; i <= to; i++)
                                                 arg_priorities |= 1 << i;
-                                } else {
-                                        for (i = to; i <= from; i++)
+                                else
+                                        for (int i = to; i <= from; i++)
                                                 arg_priorities |= 1 << i;
-                                }
 
                         } else {
-                                int p, i;
-
-                                p = log_level_from_string(opts.arg);
+                                int p = log_level_from_string(opts.arg);
                                 if (p < 0)
                                         return log_error_errno(p, "Unknown log level %s", opts.arg);
 
                                 arg_priorities = 0;
-
-                                for (i = 0; i <= p; i++)
+                                for (int i = 0; i <= p; i++)
                                         arg_priorities |= 1 << i;
                         }
 
                         break;
                 }
 
-                OPTION_LONG("facility", "FACILITY…", "Show entries with the specified facilities"): {
-                        const char *p;
-
-                        for (p = opts.arg;;) {
+                OPTION_LONG("facility", "FACILITY…", "Show entries with the specified facilities"):
+                        for (const char *p = opts.arg;;) {
                                 _cleanup_free_ char *fac = NULL;
                                 int num;
 
@@ -599,7 +588,6 @@ static int parse_argv(int argc, char *argv[], char ***remaining_args) {
                         }
 
                         break;
-                }
 
                 OPTION('g', "grep", "PATTERN", "Show entries with MESSAGE matching PATTERN"):
                         r = free_and_strdup_warn(&arg_pattern, opts.arg);