Sort includes and more cleanup and fixes in util/

This commit is contained in:
FRIGN
2014-11-13 19:54:28 +01:00
committed by sin
parent 0810c61154
commit 7d2683ddf2
48 changed files with 181 additions and 173 deletions

View File

@@ -1,3 +1,4 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <string.h>
@@ -10,10 +11,10 @@ humansize(double n)
const char postfixes[] = "BKMGTPE";
size_t i;
for(i = 0; n >= 1024 && i < strlen(postfixes); i++)
for (i = 0; n >= 1024 && i < strlen(postfixes); i++)
n /= 1024;
if(!i)
if (!i)
snprintf(buf, sizeof(buf), "%lu", (unsigned long)n);
else
snprintf(buf, sizeof(buf), "%.1f%c", n, postfixes[i]);