From: Jens Axboe Date: Wed, 8 Nov 2006 11:49:21 +0000 (+0100) Subject: [PATCH] Fix signedness issue X-Git-Tag: fio-1.10~29 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=245142ff7554290cf666e3ef6b7b57512bf17d75 [PATCH] Fix signedness issue Don't compare standard char to -1. Signed-off-by: Jens Axboe --- diff --git a/init.c b/init.c index 00f95765..badd635a 100644 --- a/init.c +++ b/init.c @@ -516,16 +516,16 @@ static void fixup_options(struct thread_data *td) static char *to_kmg(unsigned int val) { char *buf = malloc(32); - char post[] = { 0, 'K', 'M', 'G', 'P', -1 }; + char post[] = { 0, 'K', 'M', 'G', 'P', 0 }; char *p = post; - while (*p != -1) { + do { if (val & 1023) break; val >>= 10; p++; - } + } while (*p); snprintf(buf, 31, "%u%c", val, *p); return buf;