]> granicus.if.org Git - sysstat/commitdiff
Further simplify cprintf_pc
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>
Wed, 13 Sep 2017 05:50:14 +0000 (07:50 +0200)
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>
Wed, 13 Sep 2017 05:50:14 +0000 (07:50 +0200)
The former fix in cprintf_pc can be simplified further by
relying on the already existing variable "human".

Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
common.c

index 9410855b1bfdd190b592c7395ed11e5bee8034d6..262611bd5f33cd96cccb4d7e445c4648fb0c17a7 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1287,7 +1287,6 @@ void cprintf_pc(int human, int num, int wi, int wd, ...)
 {
        int i;
        double val, lim = 0.005;
-       int print_percent = 0;
        va_list args;
 
        /*
@@ -1296,7 +1295,6 @@ void cprintf_pc(int human, int num, int wi, int wd, ...)
         */
        if (human > 0) {
                lim = 0.05;
-               print_percent = 1;
                if (wi < 4) {
                        /* E.g., 100% */
                        wi = 4;
@@ -1326,7 +1324,7 @@ void cprintf_pc(int human, int num, int wi, int wd, ...)
                }
                printf(" %*.*f", wi, wd, val);
                printf("%s", sc_normal);
-               if (print_percent) printf("%%");
+               if (human > 0) printf("%%");
        }
 
        va_end(args);