summaryrefslogtreecommitdiffstats
path: root/src/libutil/expression.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 11:50:04 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 13:47:54 +0000
commit58a48db6784c101572b37ad94d2f6b1e586054a6 (patch)
tree41a8542fffce1b8f3ec726124c777ad756f9353e /src/libutil/expression.c
parent6c25c54581b480aaa2feb03e13249e9bbe0d0eac (diff)
downloadrspamd-58a48db6784c101572b37ad94d2f6b1e586054a6.tar.gz
rspamd-58a48db6784c101572b37ad94d2f6b1e586054a6.zip
Finish expression evaluation.
Diffstat (limited to 'src/libutil/expression.c')
-rw-r--r--src/libutil/expression.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/libutil/expression.c b/src/libutil/expression.c
index 113b87eca..928bfad32 100644
--- a/src/libutil/expression.c
+++ b/src/libutil/expression.c
@@ -552,7 +552,7 @@ rspamd_process_expression (struct rspamd_expression *expr, gpointer data)
struct rspamd_expression_elt *elt, *st_elt[2], *ev, *lim = NULL,
*cmp_op = NULL, *check;
guint i, j, cmp_pos = 0;
- gint cur_value = 0;
+ gint cur_value = 0, ret = 0;
gboolean done = FALSE;
g_assert (expr != NULL);
@@ -776,7 +776,18 @@ rspamd_process_expression (struct rspamd_expression *expr, gpointer data)
}
}
- return 0;
+ g_assert (expr->expression_stack->len == 1);
+ ev = rspamd_expr_stack_pop (expr);
+ ret = ev->value;
+
+ /* Cleanup */
+ for (i = 0; i < expr->expressions->len; i ++) {
+ elt = &g_array_index (expr->expressions, struct rspamd_expression_elt, i);
+ elt->value = 0;
+ elt->flags = 0;
+ }
+
+ return ret;
}
GString *