From 7cdfbd5a67ea556956c04a4e52df0f08520c86ac Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 25 Feb 2015 17:51:20 +0100 Subject: Fix formatting bug in print filter function; skip NULL filters (which would be an invalid filter anyways...) --- helper.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'helper.c') diff --git a/helper.c b/helper.c index 8dec6e4..c938783 100644 --- a/helper.c +++ b/helper.c @@ -88,6 +88,8 @@ static void helper_printavaInt(struct AttributeValueAssertion* a,const char* rel printf("[%.*s %s", (int)a->desc.l, a->desc.s, rel); if (a->value.l != 0 && a->value.s != NULL) { printf(" %.*s]", (int)a->value.l,a->value.s); + } else { + putchar(']'); } } @@ -111,17 +113,20 @@ void helper_printal(struct AttributeDescriptionList* a) static void helper_printfilterInt(struct Filter* f) { + if (f == NULL) { + printf("(nullfilter)"); + return; + } switch (f->type) { case AND: printf("&("); mergesub: helper_printfilterInt(f->x); - printf(")"); + putchar(')'); break; case OR: printf("|("); goto mergesub; - break; case NOT: printf("!("); goto mergesub; @@ -162,6 +167,7 @@ mergesub: helper_printavaInt(&f->ava,"<="); break; case PRESENT: + f->ava.value.l = 0; helper_printavaInt(&f->ava,"\\exist"); break; case APPROX: -- cgit v1.2.3-55-g7522