From: Baptiste Daroussin Date: Wed, 25 Mar 2015 07:19:13 +0000 (+0100) Subject: print_cpu_usage: Fix warnings on non linux X-Git-Tag: 2.10~43^2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c9dc67e0542a0f540b014e8b2607bfc269433951;p=i3%2Fi3status print_cpu_usage: Fix warnings on non linux Move linux variable under LINUX boundaries --- diff --git a/src/print_cpu_usage.c b/src/print_cpu_usage.c index 68437b3..2c59f69 100644 --- a/src/print_cpu_usage.c +++ b/src/print_cpu_usage.c @@ -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)