summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-03-09 19:22:05 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-03-09 19:22:05 +0000
commit67f958c224b43dec96ad08d84868e5ce1cf46931 (patch)
tree29d7d12e2d35baaec52175676338231bbabbb624 /lib
parent0040b0209cf8d0d2ae66a2ab184bc13d33c3bed3 (diff)
downloadcoreutils-67f958c224b43dec96ad08d84868e5ce1cf46931.tar.xz
Include intprops.h.
(group_number): Use INT_STRLEN_BOUND instead of rolling it ourself.
Diffstat (limited to 'lib')
-rw-r--r--lib/human.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/human.c b/lib/human.c
index 6acc03243..79336624a 100644
--- a/lib/human.c
+++ b/lib/human.c
@@ -35,6 +35,7 @@
#include <argmatch.h>
#include <error.h>
+#include <intprops.h>
#include <xstrtol.h>
#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;