From be6335128da92389defd81dc58132387f1f400d8 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Sat, 17 Mar 2001 23:54:01 +0000 Subject: Since we are now using filter-option widgets in place of system-flag, we 2001-03-17 Jeffrey Stedfast * filter-option.c (build_code): Since we are now using filter-option widgets in place of system-flag, we do not need a "code" part so if there isn't a code part, don't build it. (clone): Updated to allow NULL code parts. svn path=/trunk/; revision=8789 --- filter/ChangeLog | 7 +++++++ filter/filter-option.c | 9 ++++++--- filter/filter-part.c | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/filter/ChangeLog b/filter/ChangeLog index af70a59ec7..3bc7887e4a 100644 --- a/filter/ChangeLog +++ b/filter/ChangeLog @@ -1,3 +1,10 @@ +2001-03-17 Jeffrey Stedfast + + * filter-option.c (build_code): Since we are now using + filter-option widgets in place of system-flag, we do not need a + "code" part so if there isn't a code part, don't build it. + (clone): Updated to allow NULL code parts. + 2001-03-17 Jeffrey Stedfast * filter-element.c (filter_element_new_type_name): If the filter diff --git a/filter/filter-option.c b/filter/filter-option.c index 6a81c75f95..3992c9e46a 100644 --- a/filter/filter-option.c +++ b/filter/filter-option.c @@ -193,7 +193,7 @@ xml_create (FilterElement *fe, xmlNodePtr node) work = work->next; } d(printf ("creating new option:\n title %s\n value %s\n code %s\n", - op->title, op->value, op->code)); + op->title, op->value, op->code ? op->code : "none")); fo->options = g_list_append (fo->options, op); if (fo->current == NULL) fo->current = op; @@ -296,7 +296,7 @@ build_code (FilterElement *fe, GString *out, struct _FilterPart *ff) d(printf ("building option code %p, current = %p\n", fo, fo->current)); - if (fo->current) { + if (fo->current && fo->current->code) { filter_part_expand_code (ff, fo->current->code, out); } } @@ -328,7 +328,10 @@ clone (FilterElement *fe) d(printf (" option %s\n", op->title)); fn->title = g_strdup (op->title); fn->value = g_strdup (op->value); - fn->code = g_strdup (op->code); + if (op->code) + fn->code = g_strdup (op->code); + else + fn->code = NULL; new->options = g_list_append (new->options, fn); l = g_list_next (l); diff --git a/filter/filter-part.c b/filter/filter-part.c index 5d9df3a617..1243b6105e 100644 --- a/filter/filter-part.c +++ b/filter/filter-part.c @@ -414,7 +414,7 @@ filter_part_expand_code (FilterPart *ff, const char *source, GString *out) FilterElement *fe; start = source; - while ( (newstart = strstr (start, "${")) + while (start && (newstart = strstr (start, "${")) && (end = strstr (newstart+2, "}")) ) { len = end - newstart - 2; if (len + 1 > namelen) { -- cgit v1.2.3