From 94d75cc494069a86c3c5847227dfd696e0d5e96e Mon Sep 17 00:00:00 2001 From: Nikolas Garofil Date: Sun, 17 May 2009 01:33:43 +0200 Subject: [PATCH 1/2] add missing var --- src/conky.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/conky.c b/src/conky.c index d854c754..6db71bff 100644 --- a/src/conky.c +++ b/src/conky.c @@ -3792,6 +3792,9 @@ static void generate_text_internal(char *p, int p_max_size, #endif OBJ(execbar) { double barnum; +#ifndef X11 + int i; +#endif read_exec(obj->data.s, p, text_buffer_size); barnum = get_barnum(p); From d642a3f659d77501950aba985c3092e036a8b789 Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Sat, 16 May 2009 18:28:04 -0600 Subject: [PATCH 2/2] Fixed comment stuff for real this time? --- src/conky.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/conky.c b/src/conky.c index d854c754..19ff63f8 100644 --- a/src/conky.c +++ b/src/conky.c @@ -2903,30 +2903,35 @@ static void strfold(char *start, int count) for (curplace = start + count; *curplace != 0; curplace++) { *(curplace - count) = *curplace; } - *(curplace - count) = 0; + *(curplace - count - 1) = 0; } -static void remove_comments(char *string) +static size_t remove_comments(char *string) { char *curplace, *curplace2; - + size_t folded = 0; for (curplace = string; *curplace != 0; curplace++) { if (*curplace == '\\' && *(curplace + 1) == '#') { // strcpy can't be used for overlapping strings strfold(curplace, 1); + folded += 1; } else if (*curplace == '#') { // remove everything until we hit a '\n' curplace2 = curplace; - while (*curplace2 && *curplace2 != '\n') { + while (*curplace2) { curplace2++; + if (*curplace2 == '\n' && + *(curplace2 + 1) != '#') break; } if (*curplace2) { strfold(curplace, curplace2 - curplace); + folded += curplace2 - curplace; } else { *curplace = 0; } } } + return folded; } static int extract_variable_text_internal(struct text_object *retval, const char *const_p, char allow_threaded) @@ -2937,6 +2942,7 @@ static int extract_variable_text_internal(struct text_object *retval, const char void *ifblock_opaque = NULL; char *tmp_p; char *arg = 0; + size_t len = 0; p = strndup(const_p, max_user_text - 1); while (text_contains_templates(p)) { @@ -2974,7 +2980,6 @@ static int extract_variable_text_internal(struct text_object *retval, const char if (*p != '$') { char buf[256]; const char *var; - unsigned int len; /* variable is either $foo or ${foo} */ if (*p == '{') { @@ -3061,10 +3066,13 @@ static int extract_variable_text_internal(struct text_object *retval, const char append_object(retval, obj); } } + } else if (*p == '#') { + remove_comments(p); } p++; } remove_comments(s); + printf("'%s'\n", s); obj = create_plain_text(s); if (obj != NULL) { append_object(retval, obj);