]> git.sur5r.net Git - i3/i3status/commitdiff
print_cpu_usage: Fix warnings on non linux 13/head
authorBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 25 Mar 2015 07:19:13 +0000 (08:19 +0100)
committerBaptiste Daroussin <bapt@FreeBSD.org>
Wed, 25 Mar 2015 07:19:13 +0000 (08:19 +0100)
Move linux variable under LINUX boundaries

src/print_cpu_usage.c

index 68437b3cc9e1836ef755c1e7b251a4c8734de43e..2c59f69277ffc0452f62f2498cda0c7c093efa22 100644 (file)
@@ -40,12 +40,12 @@ static int prev_idle = 0;
 void print_cpu_usage(yajl_gen json_gen, char *buffer, const char *format) {
     const char *walk;
     char *outwalk = buffer;
-    char buf[1024];
     int curr_user = 0, curr_nice = 0, curr_system = 0, curr_idle = 0, curr_total;
     int diff_idle, diff_total, diff_usage;
 
 #if defined(LINUX)
     static char statpath[512];
+    char buf[1024];
     strcpy(statpath, "/proc/stat");
     if (!slurp(statpath, buf, sizeof(buf)) ||
         sscanf(buf, "cpu %d %d %d %d", &curr_user, &curr_nice, &curr_system, &curr_idle) != 4)