[PATCH] Fix signedness issue
authorJens Axboe <jens.axboe@oracle.com>
Wed, 8 Nov 2006 11:49:21 +0000 (12:49 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Wed, 8 Nov 2006 11:49:21 +0000 (12:49 +0100)
Don't compare standard char to -1.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
init.c

diff --git a/init.c b/init.c
index 00f957651bc1ae65164c476665d73f863d1787ee..badd635a394f45656fc8c027c83a5ad34cea6e6c 100644 (file)
--- 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);
 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;
 
        char *p = post;
 
-       while (*p != -1) {
+       do {
                if (val & 1023)
                        break;
 
                val >>= 10;
                p++;
                if (val & 1023)
                        break;
 
                val >>= 10;
                p++;
-       }
+       } while (*p);
 
        snprintf(buf, 31, "%u%c", val, *p);
        return buf;
 
        snprintf(buf, 31, "%u%c", val, *p);
        return buf;