1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-12-26 12:27:52 +00:00

Revert "exec.cc: Cache the result to another variable and return it when we have a empty/invalid value. (#646)"

This reverts commit a644600bc5.
This commit is contained in:
Kushagra Sinha 2019-03-03 17:18:54 +01:00 committed by Brenden Matthews
parent 5defb96024
commit 4cb79fb3e1

View File

@ -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;
}