From: Paul Eggert Date: Wed, 9 Mar 2005 19:22:05 +0000 (+0000) Subject: Include intprops.h. X-Git-Tag: CPPI-1_12~1362 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=67f958c224b43dec96ad08d84868e5ce1cf46931;p=thirdparty%2Fcoreutils.git Include intprops.h. (group_number): Use INT_STRLEN_BOUND instead of rolling it ourself. --- 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;