gfio: fix tickmark shortening for zero special case
authorStephen M. Cameron <stephenmcameron@gmail.com>
Mon, 12 Mar 2012 06:32:30 +0000 (07:32 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 12 Mar 2012 06:32:30 +0000 (07:32 +0100)
"0" tickmark can effectively be shortened by dividing by
any number as 0 / anything is still 0, but the code was
considering "0" to be unshortenable.

Signed-off-by: Stephen M. Cameron <stephenmcameron@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
tickmarks.c

index 2959f02..2605f72 100644 (file)
@@ -51,6 +51,8 @@ static void shorten(struct tickmark *tm, int nticks, int *power_of_ten,
                str = tm[i].string;
                l = strlen(str);
 
+               if (strcmp(str, "0") == 0)
+                       continue;
                if (l > 9 && strcmp(&str[l - 9], "000000000") == 0) {
                        *power_of_ten = 9;
                        shorten_char = use_KMG_symbols ? 'G' : '\0';