From 67f958c224b43dec96ad08d84868e5ce1cf46931 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 9 Mar 2005 19:22:05 +0000 Subject: [PATCH] Include intprops.h. (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself. --- lib/human.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/human.c b/lib/human.c index 6acc03243c..79336624a9 100644 --- a/lib/human.c +++ b/lib/human.c @@ -35,6 +35,7 @@ #include #include +#include #include #ifndef SIZE_MAX @@ -99,10 +100,8 @@ group_number (char *number, size_t numberlen, size_t i = numberlen; /* The maximum possible value for NUMBERLEN is the number of digits - in the square of the largest uintmax_t, so double the size of - uintmax_t before converting to a bound. 302 / 1000 is ceil - (log10 (2.0)). Add 1 for integer division truncation. */ - char buf[2 * sizeof (uintmax_t) * CHAR_BIT * 302 / 1000 + 1]; + in the square of the largest uintmax_t, so double the size needed. */ + char buf[2 * INT_STRLEN_BOUND (uintmax_t) + 1]; memcpy (buf, number, numberlen); d = number + numberlen; -- 2.47.3