From 4cb79fb3e1e5ec1d83ce486495164b4cf2684573 Mon Sep 17 00:00:00 2001 From: Kushagra Sinha Date: Sun, 3 Mar 2019 17:18:54 +0100 Subject: [PATCH] Revert "exec.cc: Cache the result to another variable and return it when we have a empty/invalid value. (#646)" This reverts commit a644600bc5ae8bf0971cdaf992b7c1d6c7c92553. --- src/exec.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/exec.cc b/src/exec.cc index afc9c3ce..65bc1bac 100644 --- a/src/exec.cc +++ b/src/exec.cc @@ -193,14 +193,14 @@ static void remove_deleted_chars(char *string) { * @param[in] buf output of a command executed by an exec_cb object * @return number between 0.0 and 100.0 */ -/* cache the result, so on invalid/empty values to return the cached one */ -static double cached_result = 0.0; static inline double get_barnum(const char *buf) { double barnum; if (sscanf(buf, "%lf", &barnum) != 1) { - /* don't reset execbars on invalid values. see issue #580 */ - return cached_result; + NORM_ERR( + "reading exec value failed (perhaps it's not the " + "correct format?)"); + return 0.0; } if (barnum > 100.0 || barnum < 0.0) { NORM_ERR( @@ -209,7 +209,6 @@ static inline double get_barnum(const char *buf) { return 0.0; } - cached_result = barnum; return barnum; }