chiark / gitweb /
bootchart: Convert !strcmp usage to streq
authorAuke Kok <auke-jan.h.kok@intel.com>
Thu, 10 Jan 2013 19:34:58 +0000 (11:34 -0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 10 Jan 2013 20:21:42 +0000 (15:21 -0500)
src/bootchart/bootchart.c
src/bootchart/log.c

index 3d77bab..7bcfd98 100644 (file)
@@ -28,6 +28,7 @@
 
 
 #include "bootchart.h"
+#include "util.h"
 
 double graph_start;
 double log_start;
@@ -109,25 +110,25 @@ int main(int argc, char *argv[])
 
                         // todo: filter leading/trailing whitespace
 
-                        if (!strcmp(key, "samples"))
+                        if (streq(key, "samples"))
                                 len = atoi(val);
-                        if (!strcmp(key, "freq"))
+                        if (streq(key, "freq"))
                                 hz = atof(val);
-                        if (!strcmp(key, "rel"))
+                        if (streq(key, "rel"))
                                 relative = atoi(val);
-                        if (!strcmp(key, "filter"))
+                        if (streq(key, "filter"))
                                 filter = atoi(val);
-                        if (!strcmp(key, "pss"))
+                        if (streq(key, "pss"))
                                 pss = atoi(val);
-                        if (!strcmp(key, "output"))
+                        if (streq(key, "output"))
                                 strncpy(output_path, val, PATH_MAX - 1);
-                        if (!strcmp(key, "init"))
+                        if (streq(key, "init"))
                                 strncpy(init_path, val, PATH_MAX - 1);
-                        if (!strcmp(key, "scale_x"))
+                        if (streq(key, "scale_x"))
                                 scale_x = atof(val);
-                        if (!strcmp(key, "scale_y"))
+                        if (streq(key, "scale_y"))
                                 scale_y = atof(val);
-                        if (!strcmp(key, "entropy"))
+                        if (streq(key, "entropy"))
                                 entropy = atoi(val);
                 }
                 fclose(f);
index 78f0cab..c697121 100644 (file)
@@ -26,6 +26,7 @@
 
 
 #include "bootchart.h"
+#include "util.h"
 
 /*
  * Alloc a static 4k buffer for stdio - primarily used to increase
@@ -125,9 +126,9 @@ void log_sample(int sample)
         while (m) {
                 if (sscanf(m, "%s %s", key, val) < 2)
                         goto vmstat_next;
-                if (!strcmp(key, "pgpgin"))
+                if (streq(key, "pgpgin"))
                         blockstat[sample].bi = atoi(val);
-                if (!strcmp(key, "pgpgout")) {
+                if (streq(key, "pgpgout")) {
                         blockstat[sample].bo = atoi(val);
                         break;
                 }