From: Jens Axboe Date: Wed, 15 Sep 2010 21:05:57 +0000 (+0200) Subject: Revert "Improvements for num2str()" X-Git-Tag: fio-1.44-rc1~7^2 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=92a3d86ed1b2040c618b296e4d2ce503352792bc Revert "Improvements for num2str()" This reverts commit ef5249d5e5f0bb5f0adfb182b1dbc988aee976de. --- diff --git a/fio.h b/fio.h index dfd86957..e8c025d6 100644 --- a/fio.h +++ b/fio.h @@ -661,7 +661,7 @@ static inline char *num2str(unsigned long num, int maxlen, int base, int pow2) char postfix[] = { ' ', 'K', 'M', 'G', 'P', 'E' }; unsigned int thousand; char *buf; - int i, mod = 0; + int i; if (pow2) thousand = 1024; @@ -679,19 +679,6 @@ static inline char *num2str(unsigned long num, int maxlen, int base, int pow2) len = sprintf(buf, "%'lu", num); if (len <= maxlen) { if (i >= 1) { - char dec[4]; - int j = 0; - - sprintf(dec, "%u", mod); - if (maxlen - len >= 2) { - buf[len++] = '.'; - while (maxlen - len) { - buf[len++] = dec[j++]; - if (j == sizeof(dec) - 1) - break; - } - } - buf[len] = postfix[i]; buf[len + 1] = '\0'; } @@ -701,7 +688,6 @@ static inline char *num2str(unsigned long num, int maxlen, int base, int pow2) if ((num % thousand) >= (thousand / 2)) carry = 1; - mod = num % thousand; num /= thousand; num += carry; i++;