From a0dde733ac750582242d36b8814b216f30acd5e3 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 28 Oct 2021 16:43:27 +0200 Subject: [PATCH] systemctl: use LESS_BY where appropriate --- src/systemctl/systemctl-show.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c index c3a9ba763d6..ea4ac63c44b 100644 --- a/src/systemctl/systemctl-show.c +++ b/src/systemctl/systemctl-show.c @@ -710,11 +710,7 @@ static void print_status_info( printf(" CGroup: %s\n", i->control_group); - c = columns(); - if (c > sizeof(prefix) - 1) - c -= sizeof(prefix) - 1; - else - c = 0; + c = LESS_BY(columns(), strlen(prefix)); r = unit_show_processes(bus, i->id, i->control_group, prefix, c, get_output_flags(), &error); if (r == -EBADR) { @@ -2097,11 +2093,7 @@ static int show_system_status(sd_bus *bus) { static const char prefix[] = " "; unsigned c; - c = columns(); - if (c > sizeof(prefix) - 1) - c -= sizeof(prefix) - 1; - else - c = 0; + c = LESS_BY(columns(), strlen(prefix)); show_cgroup(SYSTEMD_CGROUP_CONTROLLER, strempty(mi.control_group), prefix, c, get_output_flags()); }