diff options
author | Mike Yuan <me@yhndnzj.com> | 2023-12-25 10:34:57 +0100 |
---|---|---|
committer | Mike Yuan <me@yhndnzj.com> | 2023-12-25 10:47:18 +0100 |
commit | 2413a0fab4fdad7eef3ce1d4b57664be5795b002 (patch) | |
tree | e7a21c95fa93122312f4243b211e668ca11a2cdf /src/portable | |
parent | siphash24: introduce siphash24_compress_typesafe() macro (diff) | |
download | systemd-2413a0fab4fdad7eef3ce1d4b57664be5795b002.tar.xz systemd-2413a0fab4fdad7eef3ce1d4b57664be5795b002.zip |
format-table: introduce table_isempty and use it where appropriate
Diffstat (limited to 'src/portable')
-rw-r--r-- | src/portable/portablectl.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 532e8d9345..cf3122e29c 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -1030,7 +1030,7 @@ static int list_images(int argc, char *argv[], void *userdata) { if (r < 0) return bus_log_parse_error(r); - if (table_get_rows(table) > 1) { + if (!table_isempty(table)) { r = table_set_sort(table, (size_t) 0); if (r < 0) return table_log_sort_error(r); @@ -1043,10 +1043,10 @@ static int list_images(int argc, char *argv[], void *userdata) { } if (arg_legend) { - if (table_get_rows(table) > 1) - printf("\n%zu images listed.\n", table_get_rows(table) - 1); - else + if (table_isempty(table)) printf("No images.\n"); + else + printf("\n%zu images listed.\n", table_get_rows(table) - 1); } return 0; |