From 8b17198eb61947b5169e5621d3dfc4a3a01764fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BChler?= Date: Sun, 8 Aug 2010 23:36:20 +0200 Subject: [PATCH] Try to fix some bugs in the config parser --- src/main/config_parser.rl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/config_parser.rl b/src/main/config_parser.rl index fa0bd39..c557555 100644 --- a/src/main/config_parser.rl +++ b/src/main/config_parser.rl @@ -1031,7 +1031,7 @@ /* loop over all actions until we find the last without target_else */ while (TRUE) { - for (cond_and = cond; (uintptr_t)cond->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { + for (cond_and = cond; (uintptr_t)cond_and->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { cond_and->data.condition.target = (liAction*)((uintptr_t)cond_and->data.condition.target & (~0x1)); cond_and->data.condition.target->data.condition.target_else = target; } @@ -1064,7 +1064,7 @@ /* loop over all actions until we find the last without target_else */ while (TRUE) { - for (cond_and = cond; (uintptr_t)cond->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { + for (cond_and = cond; (uintptr_t)cond_and->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { cond_and->data.condition.target = (liAction*)((uintptr_t)cond_and->data.condition.target & (~0x1)); cond_and->data.condition.target->data.condition.target_else = target; @@ -1089,11 +1089,11 @@ _printf("got condition_chain in line %zd\n", ctx->line); /* loop over all actions looking for 'and' markers and clear them */ - while (cond) { + while (cond && cond->type == ACTION_TCONDITION) { _printf("condition: %p if: %p else: %p\n", (void*)cond, (void*)cond->data.condition.target, (void*)cond->data.condition.target_else); - for (cond_and = cond; (uintptr_t)cond->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { + for (cond_and = cond; cond_and && (cond_and->type == ACTION_TCONDITION) && (uintptr_t)cond_and->data.condition.target & 0x1; cond_and = cond_and->data.condition.target) { cond_and->data.condition.target = (liAction*)((uintptr_t)cond_and->data.condition.target & (~0x1)); - _printf("condition: if: %p else: %p\n", (void*)cond->data.condition.target, (void*)cond->data.condition.target_else); + _printf("condition_and: %p if: %p else: %p\n", (void*)cond_and, (void*)cond_and->data.condition.target, (void*)cond_and->data.condition.target_else); } if (cond->data.condition.target_else)