]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
id128: rework conditional to reduce indentation
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 27 Aug 2023 11:56:32 +0000 (14:56 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 2 Sep 2023 11:17:29 +0000 (14:17 +0300)
src/id128/id128.c

index 18e08808057ac20953f23ba2333c5855cc3d6a67..9e0a3488dd5fe69db80551ef2419ff5730321df3 100644 (file)
@@ -93,23 +93,22 @@ static int show_one(Table **table, const char *name, sd_id128_t uuid, bool first
                 if (!first)
                         puts("");
                 return 0;
+        }
 
-        } else if (arg_value)
+        if (arg_value)
                 return id128_pretty_print(u, arg_mode);
 
-        else {
-                if (!*table) {
-                        *table = table_new("name", "id");
-                        if (!*table)
-                                return log_oom();
-                        table_set_width(*table, 0);
-                }
-
-                return table_add_many(*table,
-                                      TABLE_STRING, name,
-                                      arg_mode == ID128_PRINT_ID128 ? TABLE_ID128 : TABLE_UUID,
-                                      u);
+        if (!*table) {
+                *table = table_new("name", "id");
+                if (!*table)
+                        return log_oom();
+                table_set_width(*table, 0);
         }
+
+        return table_add_many(*table,
+                              TABLE_STRING, name,
+                              arg_mode == ID128_PRINT_ID128 ? TABLE_ID128 : TABLE_UUID,
+                              u);
 }
 
 static int verb_show(int argc, char **argv, void *userdata) {