From a0b8c4ad6104581f44775c9d0f4d6b297351ba06 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 31 Jul 2023 16:38:02 -0700 Subject: [PATCH] kill: prefer signed types * src/kill.c (list_signals): Prefer signed types. This avoids undefined behavior on theoretical platforms where unsigned and signed int have different representations. --- src/kill.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/kill.c b/src/kill.c index 81f6fba8b8..47aaa16132 100644 --- a/src/kill.c +++ b/src/kill.c @@ -131,10 +131,10 @@ list_signals (bool table, char *const *argv) if (table) { - unsigned int name_width = 0; + int name_width = 0; /* Compute the maximum width of a signal number. */ - unsigned int num_width = 1; + int num_width = 1; for (signum = 1; signum <= SIGNUM_BOUND / 10; signum *= 10) num_width++; @@ -142,7 +142,7 @@ list_signals (bool table, char *const *argv) for (signum = 1; signum <= SIGNUM_BOUND; signum++) if (sig2str (signum, signame) == 0) { - size_t len = strlen (signame); + idx_t len = strlen (signame); if (name_width < len) name_width = len; } -- 2.47.2