Add macros to determine the length of an integer type in string form.

Adapted from answer #6 in:
https://stackoverflow.com/questions/10536207/ansi-c-maximum-number-of-characters-printing-a-decimal-int
This commit is contained in:
Todd C. Miller
2023-09-19 15:15:02 -06:00
parent 221a10340c
commit d53bbb54b2
12 changed files with 16 additions and 12 deletions

View File

@@ -112,7 +112,7 @@ struct sudo_debug_instance {
static struct sudo_debug_instance *sudo_debug_instances[SUDO_DEBUG_INSTANCE_MAX];
static int sudo_debug_last_instance = -1;
static char sudo_debug_pidstr[(((sizeof(int) * 8) + 2) / 3) + 3];
static char sudo_debug_pidstr[STRLEN_MAX_SIGNED(int) + 3];
static size_t sudo_debug_pidlen;
#define round_nfds(_n) (((_n) + (4 * NBBY) - 1) & ~((4 * NBBY) - 1))