From 1779ef3efda5d7e103cb986641802c4385dab153 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Fri, 22 May 2009 12:29:41 -0600 Subject: [PATCH] Fix (possibly overkill) hwmon parsing bug. --- src/conky.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/conky.c b/src/conky.c index a34bf255..3553b357 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1835,18 +1835,18 @@ static struct text_object *construct_text_object(const char *s, return NULL; } - buf1[0] = 0; - factor = 1.0; - offset = 0.0; +#define HWMON_RESET() {\ + buf1[0] = 0; \ + factor = 1.0; \ + offset = 0.0; } - if (sscanf(arg, "%63s %63s %d %f %f", buf1, buf2, &n, &factor, &offset) == 5) - found = 1; - if (!found && (sscanf(arg, "%63s %d %f %f", buf2, &n, &factor, &offset) == 3)) - found = 1; - if (!found && (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) == 3)) - found = 1; - if (!found && (sscanf(arg, "%63s %d", buf2, &n) == 2)) - found = 1; + if (sscanf(arg, "%63s %63s %d %f %f", buf1, buf2, &n, &factor, &offset) == 5) found = 1; else HWMON_RESET(); + if (!found && (sscanf(arg, "%63s %d %f %f", buf2, &n, &factor, &offset) == 3)) found = 1; else HWMON_RESET(); + if (!found && (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) == 3)) found = 1; else HWMON_RESET(); + if (!found && (sscanf(arg, "%63s %d", buf2, &n) == 2)) found = 1; else HWMON_RESET(); + + +#undef HWMON_RESET if (!found) { ERR("hwmon failed to parse arguments");