From 37cbdcf89b0879b496dea6149d068324e35846a4 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Sat, 28 Nov 2009 23:02:58 +0100 Subject: [PATCH] convert $endif to callbacks.print --- src/conky.c | 3 --- src/core.c | 1 + src/text_object.c | 7 +++++++ src/text_object.h | 4 ++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/conky.c b/src/conky.c index 5e3aac3f..47cbcf10 100644 --- a/src/conky.c +++ b/src/conky.c @@ -804,9 +804,6 @@ void generate_text_internal(char *p, int p_max_size, need_to_load_fonts = 1; } #endif /* X11 */ - OBJ(endif) { - /* harmless object, just ignore */ - } OBJ(pid_chroot) { char buf[max_user_text]; diff --git a/src/core.c b/src/core.c index d45fce2b..0ae6e89c 100644 --- a/src/core.c +++ b/src/core.c @@ -547,6 +547,7 @@ struct text_object *construct_text_object(const char *s, const char *arg, long obj->callbacks.iftest = &gen_false_iftest; END OBJ(endif, 0) obj_be_ifblock_endif(ifblock_opaque, obj); + obj->callbacks.print = &gen_print_nothing; END OBJ(eval, 0) obj->data.s = strndup(arg ? arg : "", text_buffer_size); obj->callbacks.print = &print_evaluate; diff --git a/src/text_object.c b/src/text_object.c index be66f808..0da03c37 100644 --- a/src/text_object.c +++ b/src/text_object.c @@ -43,6 +43,13 @@ int gen_false_iftest(struct text_object *obj) return 0; } +void gen_print_nothing(struct text_object *obj, char *p, int p_max_size) +{ + (void)obj; + (void)p; + (void)p_max_size; +} + /* text_object_list * * this list is special. it looks like this: diff --git a/src/text_object.h b/src/text_object.h index c89c70b4..6c083a15 100644 --- a/src/text_object.h +++ b/src/text_object.h @@ -497,6 +497,10 @@ void gen_free_opaque(struct text_object *); * used for the else object */ int gen_false_iftest(struct text_object *); +/* generic nothing printer callback printing nothing + * used for the endif object */ +void gen_print_nothing(struct text_object *, char *, int); + struct text_object { struct text_object *next, *prev; /* doubly linked list of text objects */ struct text_object *sub; /* for objects parsing text into objects */