aboutsummaryrefslogtreecommitdiffstats
path: root/src/libutil/expression.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-28 23:00:11 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-28 23:00:11 +0000
commitb303477f7addbc15365aeae4d0cdeadf60fa21b1 (patch)
treef8a952e27c1334476b181db32e3b64bcbef7e475 /src/libutil/expression.c
parent86ae36d19ff7291784e1a638fe192a66a160d538 (diff)
downloadrspamd-b303477f7addbc15365aeae4d0cdeadf60fa21b1.tar.gz
rspamd-b303477f7addbc15365aeae4d0cdeadf60fa21b1.zip
Add flags to expressions processing and noopt flag.
Diffstat (limited to 'src/libutil/expression.c')
-rw-r--r--src/libutil/expression.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libutil/expression.c b/src/libutil/expression.c
index d9f1a1260..b2655b518 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -806,7 +806,7 @@ rspamd_ast_do_op (struct rspamd_expression_elt *elt, gint val, gint acc)
}
static gint
-rspamd_ast_process_node (struct rspamd_expression *expr, GNode *node,
+rspamd_ast_process_node (struct rspamd_expression *expr, gint flags, GNode *node,
gpointer data)
{
struct rspamd_expression_elt *elt, *celt, *parelt;
@@ -846,7 +846,7 @@ rspamd_ast_process_node (struct rspamd_expression *expr, GNode *node,
celt = cld->data;
/* Save limit if we've found it */
- val = rspamd_ast_process_node (expr, cld, data);
+ val = rspamd_ast_process_node (expr, flags, cld, data);
if (acc == G_MININT) {
acc = val;
@@ -854,8 +854,10 @@ rspamd_ast_process_node (struct rspamd_expression *expr, GNode *node,
acc = rspamd_ast_do_op (elt, val, acc);
- if (rspamd_ast_node_done (elt, parelt, acc, lim)) {
- return acc;
+ if (!(flags & RSPAMD_EXPRESSION_FLAG_NOOPT)) {
+ if (rspamd_ast_node_done (elt, parelt, acc, lim)) {
+ return acc;
+ }
}
}
break;
@@ -876,7 +878,8 @@ rspamd_ast_cleanup_traverse (GNode *n, gpointer d)
}
gint
-rspamd_process_expression (struct rspamd_expression *expr, gpointer data)
+rspamd_process_expression (struct rspamd_expression *expr, gint flags,
+ gpointer data)
{
gint ret = 0;
@@ -884,7 +887,7 @@ rspamd_process_expression (struct rspamd_expression *expr, gpointer data)
/* Ensure that stack is empty at this point */
g_assert (expr->expression_stack->len == 0);
- ret = rspamd_ast_process_node (expr, expr->ast, data);
+ ret = rspamd_ast_process_node (expr, flags, expr->ast, data);
/* Cleanup */
g_node_traverse (expr->ast, G_IN_ORDER, G_TRAVERSE_ALL, -1,