const struct rspamd_atom_subr *subr;
GArray *expressions;
GArray *expression_stack;
+ GNode *ast;
};
static GQuark
}
static void
-rspamd_expr_stack_push (struct rspamd_expression *expr,
+rspamd_expr_stack_elt_push (GArray *stack,
gpointer elt)
{
- g_array_append_val (expr->expression_stack, elt);
+ g_array_append_val (stack, elt);
}
static gpointer
-rspamd_expr_stack_pop (struct rspamd_expression *expr)
+rspamd_expr_stack_elt_pop (GArray *stack)
{
gpointer e;
gint idx;
- if (expr->expression_stack->len == 0) {
+ if (stack->len == 0) {
return NULL;
}
- idx = expr->expression_stack->len - 1;
- e = g_array_index (expr->expression_stack, gpointer, idx);
- g_array_remove_index_fast (expr->expression_stack, idx);
+ idx = stack->len - 1;
+ e = g_array_index (stack, gpointer, idx);
+ g_array_remove_index_fast (stack, idx);
return e;
}
+static void
+rspamd_expr_stack_push (struct rspamd_expression *expr,
+ gpointer elt)
+{
+ rspamd_expr_stack_elt_push (expr->expression_stack, elt);
+}
+
+static gpointer
+rspamd_expr_stack_pop (struct rspamd_expression *expr)
+{
+ return rspamd_expr_stack_elt_pop (expr->expression_stack);
+}
+
/*
* Return operation priority
*/
g_array_free (expr->expressions, TRUE);
g_array_free (expr->expression_stack, TRUE);
+ g_node_destroy (expr->ast);
}
}
e = g_slice_alloc (sizeof (*e));
e->expressions = g_array_new (FALSE, FALSE,
sizeof (struct rspamd_expression_elt));
+ e->ast = NULL;
e->expression_stack = g_array_sized_new (FALSE, FALSE, sizeof (gpointer), 32);
e->subr = subr;