From c5a8949784df2d6ebc546433819e58d67669f4ef Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Fri, 4 Dec 2009 01:22:36 +0100 Subject: [PATCH] convert mem_barval to double --- src/common.c | 4 ++-- src/common.h | 2 +- src/core.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common.c b/src/common.c index 3fb70417..f1bffcb4 100644 --- a/src/common.c +++ b/src/common.c @@ -511,11 +511,11 @@ uint8_t mem_percentage(struct text_object *obj) return (info.memmax ? round_to_int(info.mem * 100 / info.memmax) : 0); } -uint8_t mem_barval(struct text_object *obj) +double mem_barval(struct text_object *obj) { (void)obj; - return round_to_int(info.memmax ? (info.mem * 255 / info.memmax) : 0); + return info.memmax ? ((double)info.mem / info.memmax) : 0; } uint8_t swap_percentage(struct text_object *obj) diff --git a/src/common.h b/src/common.h index 06e8f273..cef49295 100644 --- a/src/common.h +++ b/src/common.h @@ -81,7 +81,7 @@ void print_swap(struct text_object *, char *, int); void print_swapfree(struct text_object *, char *, int); void print_swapmax(struct text_object *, char *, int); uint8_t mem_percentage(struct text_object *); -uint8_t mem_barval(struct text_object *); +double mem_barval(struct text_object *); uint8_t swap_percentage(struct text_object *); uint8_t swap_barval(struct text_object *); diff --git a/src/core.c b/src/core.c index b6d84a3b..a6f5749b 100644 --- a/src/core.c +++ b/src/core.c @@ -812,15 +812,15 @@ struct text_object *construct_text_object(const char *s, const char *arg, long END OBJ(memperc, &update_meminfo) obj->callbacks.percentage = &mem_percentage; END OBJ(memgauge, &update_meminfo) - scan_gauge(obj, arg, 255); + scan_gauge(obj, arg, 1); obj->callbacks.gaugeval = &mem_barval; END OBJ(membar, &update_meminfo) - scan_bar(obj, arg, 255); + scan_bar(obj, arg, 1); obj->callbacks.barval = &mem_barval; #ifdef X11 END OBJ(memgraph, &update_meminfo) char *buf = 0; - buf = scan_graph(obj, arg, 255); + buf = scan_graph(obj, arg, 1); if (buf) free(buf); obj->callbacks.graphval = &mem_barval;