From 0188eb0aaaaa0e0f7a78a78fd7f25af04f3b01fe Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Mon, 16 Nov 2009 22:49:31 +0100 Subject: [PATCH] top: convert to callbacks.print --- src/conky.c | 13 ------------- src/core.c | 3 +++ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/conky.c b/src/conky.c index be09b0dd..4793ee73 100644 --- a/src/conky.c +++ b/src/conky.c @@ -1492,19 +1492,6 @@ void generate_text_internal(char *p, int p_max_size, } #endif /* XMMS */ - /* we have four different types of top (top, top_mem, - * top_time and top_io). To avoid having almost-same code four - * times, we have this special handler. */ -#ifdef __linux__ - break; - case OBJ_top: - case OBJ_top_mem: - case OBJ_top_time: -#ifdef IOSTATS - case OBJ_top_io: -#endif - print_top(obj, p, p_max_size); -#endif /* __linux__ */ #ifdef HAVE_ICONV OBJ(iconv_start) { do_iconv_start(obj); diff --git a/src/core.c b/src/core.c index 7486e68a..d0eab024 100644 --- a/src/core.c +++ b/src/core.c @@ -643,12 +643,15 @@ struct text_object *construct_text_object(const char *s, const char *arg, long /* we have four different types of top (top, top_mem, top_time and top_io). To * avoid having almost-same code four times, we have this special * handler. */ + /* XXX: maybe fiddle them apart later, as print_top() does + * nothing else than just that, using an ugly switch(). */ if (strncmp(s, "top", 3) == EQUAL) { add_update_callback(&update_meminfo); add_update_callback(&update_top); if (!parse_top_args(s, arg, obj)) { return NULL; } + obj->callbacks.print = &print_top; } else OBJ(addr, &update_net_stats) parse_net_stat_arg(obj, arg, free_at_crash); obj->callbacks.print = &print_addr;