diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-13 17:34:57 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-12-13 17:35:45 +0200 |
commit | 5d4b76c56c558bfbd968e95ec57ff7055417d158 (patch) | |
tree | e60d9c27e57155b7edb63efe60636262f47b68d4 | |
parent | a1612b96fc4592af50cb65caff5b54e74f437b09 (diff) | |
download | mailutils-5d4b76c56c558bfbd968e95ec57ff7055417d158.tar.gz mailutils-5d4b76c56c558bfbd968e95ec57ff7055417d158.tar.bz2 |
Bugfixes
* libmu_sieve/sieve.y: Fix compilation of chained elsif conditions.
* sieve/sieve.c: Define the location environment item.
-rw-r--r-- | libmu_sieve/sieve.y | 29 | ||||
-rw-r--r-- | sieve/sieve.c | 1 |
2 files changed, 8 insertions, 22 deletions
diff --git a/libmu_sieve/sieve.y b/libmu_sieve/sieve.y index 0a612f1ba..e39ac7275 100644 --- a/libmu_sieve/sieve.y +++ b/libmu_sieve/sieve.y @@ -32,7 +32,6 @@ static struct mu_sieve_node *sieve_tree; static struct mu_sieve_node *node_alloc (enum mu_sieve_node_type, struct mu_locus_range *); -static void cond_join (struct mu_sieve_node *node); #define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ @@ -158,17 +157,13 @@ statement : REQUIRE stringorlist ';' else_part : maybe_elsif { - cond_join ($1.head); $$ = $1.head; } | maybe_elsif ELSE block { - $3->prev = $1.tail; - if ($1.head) + if ($1.tail) { - $1.tail->next = $3; - $1.tail = $3; - cond_join ($1.head); + $1.tail->v.cond.iffalse = $3; $$ = $1.head; } else @@ -183,6 +178,8 @@ maybe_elsif : /* empty */ | elsif_branch ; +/* elsif branches form a singly-linked version of node_list. Nodes in + this list are linked by v.cond.iffalse pointer */ elsif_branch : ELSIF cond block { struct mu_sieve_node *node = @@ -199,10 +196,10 @@ elsif_branch : ELSIF cond block node->v.cond.expr = $3; node->v.cond.iftrue = $4; node->v.cond.iffalse = NULL; - - node->prev = $1.tail; - $1.tail->next = node; + + $1.tail->v.cond.iffalse = node; $1.tail = node; + $$ = $1; } ; @@ -405,18 +402,6 @@ yyerror (const char *s) mu_i_sv_error (mu_sieve_machine); return 0; } - -static void -cond_join (struct mu_sieve_node *node) -{ - while (node && node->type == mu_sieve_node_cond) - { - struct mu_sieve_node *next = node->next; - node->prev = node->next = NULL; - node->v.cond.iffalse = next; - node = next; - } -} static struct mu_sieve_node * node_alloc (enum mu_sieve_node_type type, struct mu_locus_range *lr) diff --git a/sieve/sieve.c b/sieve/sieve.c index 8cb77bc86..dc429a60e 100644 --- a/sieve/sieve.c +++ b/sieve/sieve.c @@ -485,6 +485,7 @@ main (int argc, char *argv[]) return EX_SOFTWARE; } + sieve_setenv ("location=MS", mach); sieve_setenv ("phase=post", mach); mu_list_foreach (env_list, sieve_setenv, mach); mu_list_destroy (&env_list); |