diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-08-27 13:56:32 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-09-02 13:17:29 +0200 |
commit | 716126c069d8454450914bb2d2917d6367872da7 (patch) | |
tree | 9f79aa2b65636515b2bbae763b9f5ff905f15fe8 /src/id128/id128.c | |
parent | sd-id128: do not allow null 'app_id' param (diff) | |
download | systemd-716126c069d8454450914bb2d2917d6367872da7.tar.xz systemd-716126c069d8454450914bb2d2917d6367872da7.zip |
id128: rework conditional to reduce indentation
Diffstat (limited to '')
-rw-r--r-- | src/id128/id128.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/id128/id128.c b/src/id128/id128.c index 18e0880805..9e0a3488dd 100644 --- a/src/id128/id128.c +++ b/src/id128/id128.c @@ -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) { |