Skip to content

Commit

Permalink
filterx: rename _eval() methods to specific names
Browse files Browse the repository at this point in the history
To make it easier to understand stackdumps.

Signed-off-by: Balazs Scheidler <[email protected]>
  • Loading branch information
bazsi committed Dec 30, 2024
1 parent 8ab5fd0 commit 3d96664
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 46 deletions.
6 changes: 3 additions & 3 deletions lib/filterx/expr-comparison.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ _eval_based_on_compare_mode(FilterXExpr *expr, gint compare_mode)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_comparison(FilterXExpr *s)
{
FilterXComparison *self = (FilterXComparison *) s;

Expand Down Expand Up @@ -250,7 +250,7 @@ _optimize(FilterXExpr *s)
self->literal_rhs = _eval_based_on_compare_mode(self->super.rhs, compare_mode);

if (self->literal_lhs && self->literal_rhs)
return filterx_literal_new(_eval(&self->super.super));
return filterx_literal_new(_eval_comparison(&self->super.super));

return NULL;
}
Expand All @@ -273,7 +273,7 @@ filterx_comparison_new(FilterXExpr *lhs, FilterXExpr *rhs, gint operator)

filterx_binary_op_init_instance(&self->super, "comparison", lhs, rhs);
self->super.super.optimize = _optimize;
self->super.super.eval = _eval;
self->super.super.eval = _eval_comparison;
self->super.super.free_fn = _filterx_comparison_free;
self->operator = operator;

Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-compound.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ _eval_exprs(FilterXCompoundExpr *self, FilterXObject **result)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_compound(FilterXExpr *s)
{
FilterXCompoundExpr *self = (FilterXCompoundExpr *) s;
FilterXObject *result = NULL;
Expand Down Expand Up @@ -220,7 +220,7 @@ filterx_compound_expr_new(gboolean return_value_of_last_expr)
FilterXCompoundExpr *self = g_new0(FilterXCompoundExpr, 1);

filterx_expr_init_instance(&self->super, "compound");
self->super.eval = _eval;
self->super.eval = _eval_compound;
self->super.optimize = _optimize;
self->super.init = _init;
self->super.deinit = _deinit;
Expand Down
6 changes: 3 additions & 3 deletions lib/filterx/expr-condition.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ _free(FilterXExpr *s)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_conditional(FilterXExpr *s)
{
FilterXConditional *self = (FilterXConditional *) s;
FilterXObject *condition_value = filterx_expr_eval(self->condition);
Expand Down Expand Up @@ -201,7 +201,7 @@ filterx_conditional_new(FilterXExpr *condition)
{
FilterXConditional *self = g_new0(FilterXConditional, 1);
filterx_expr_init_instance(&self->super, "conditional");
self->super.eval = _eval;
self->super.eval = _eval_conditional;
self->super.optimize = _optimize;
self->super.init = _init;
self->super.deinit = _deinit;
Expand All @@ -215,7 +215,7 @@ FilterXExpr *
filterx_conditional_find_tail(FilterXExpr *s)
{
/* check if this is a FilterXConditional instance */
if (s->eval != _eval)
if (s->eval != _eval_conditional)
return NULL;

FilterXConditional *self = (FilterXConditional *) s;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-done.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "filterx/object-primitive.h"

static FilterXObject *
_eval(FilterXExpr *s)
_eval_done(FilterXExpr *s)
{
FilterXEvalContext *context = filterx_eval_get_context();
context->eval_control_modifier = FXC_DONE;
Expand All @@ -41,7 +41,7 @@ filterx_expr_done(void)
{
FilterXExpr *self = g_new0(FilterXExpr, 1);
filterx_expr_init_instance(self, "done");
self->eval = _eval;
self->eval = _eval_done;

return self;
}
4 changes: 2 additions & 2 deletions lib/filterx/expr-drop.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "filterx/object-primitive.h"

static FilterXObject *
_eval(FilterXExpr *s)
_eval_drop(FilterXExpr *s)
{
FilterXEvalContext *context = filterx_eval_get_context();
context->eval_control_modifier = FXC_DROP;
Expand All @@ -40,7 +40,7 @@ filterx_expr_drop_msg(void)
{
FilterXExpr *self = g_new0(FilterXExpr, 1);
filterx_expr_init_instance(self, "drop");
self->eval = _eval;
self->eval = _eval_drop;

return self;
}
6 changes: 3 additions & 3 deletions lib/filterx/expr-generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ filterx_generator_set_fillable(FilterXExpr *s, FilterXExpr *fillable)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_generator(FilterXExpr *s)
{
FilterXExprGenerator *self = (FilterXExprGenerator *) s;

Expand All @@ -52,7 +52,7 @@ _eval(FilterXExpr *s)
gboolean
filterx_expr_is_generator(FilterXExpr *s)
{
return s && s->eval == _eval;
return s && s->eval == _eval_generator;
}

FilterXExpr *
Expand All @@ -71,7 +71,7 @@ filterx_generator_init_instance(FilterXExpr *s)
s->optimize = filterx_generator_optimize_method;
s->init = filterx_generator_init_method;
s->deinit = filterx_generator_deinit_method;
s->eval = _eval;
s->eval = _eval_generator;
s->ignore_falsy_result = TRUE;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-get-subscript.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ typedef struct _FilterXGetSubscript
} FilterXGetSubscript;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_get_subscript(FilterXExpr *s)
{
FilterXGetSubscript *self = (FilterXGetSubscript *) s;
FilterXObject *result = NULL;
Expand Down Expand Up @@ -158,7 +158,7 @@ filterx_get_subscript_new(FilterXExpr *operand, FilterXExpr *key)
FilterXGetSubscript *self = g_new0(FilterXGetSubscript, 1);

filterx_expr_init_instance(&self->super, "get_subscript");
self->super.eval = _eval;
self->super.eval = _eval_get_subscript;
self->super.is_set = _isset;
self->super.unset = _unset;
self->super.optimize = _optimize;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-getattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct _FilterXGetAttr
} FilterXGetAttr;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_getattr(FilterXExpr *s)
{
FilterXGetAttr *self = (FilterXGetAttr *) s;

Expand Down Expand Up @@ -137,7 +137,7 @@ filterx_getattr_new(FilterXExpr *operand, FilterXString *attr_name)
FilterXGetAttr *self = g_new0(FilterXGetAttr, 1);

filterx_expr_init_instance(&self->super, "getattr");
self->super.eval = _eval;
self->super.eval = _eval_getattr;
self->super.unset = _unset;
self->super.is_set = _isset;
self->super.optimize = _optimize;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-isset.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "filterx/object-primitive.h"

static FilterXObject *
_eval(FilterXExpr *s)
_eval_isset(FilterXExpr *s)
{
FilterXUnaryOp *self = (FilterXUnaryOp *) s;

Expand All @@ -37,6 +37,6 @@ filterx_isset_new(FilterXExpr *expr)
{
FilterXUnaryOp *self = g_new0(FilterXUnaryOp, 1);
filterx_unary_op_init_instance(self, "isset", expr);
self->super.eval = _eval;
self->super.eval = _eval_isset;
return &self->super;
}
6 changes: 3 additions & 3 deletions lib/filterx/expr-literal.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef struct _FilterXLiteral
} FilterXLiteral;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_literal(FilterXExpr *s)
{
FilterXLiteral *self = (FilterXLiteral *) s;
return filterx_object_ref(self->object);
Expand All @@ -50,7 +50,7 @@ filterx_literal_new(FilterXObject *object)
FilterXLiteral *self = g_new0(FilterXLiteral, 1);

filterx_expr_init_instance(&self->super, "literal");
self->super.eval = _eval;
self->super.eval = _eval_literal;
self->super.free_fn = _free;
self->object = object;
return &self->super;
Expand All @@ -59,5 +59,5 @@ filterx_literal_new(FilterXObject *object)
gboolean
filterx_expr_is_literal(FilterXExpr *expr)
{
return expr->eval == _eval;
return expr->eval == _eval_literal;
}
4 changes: 2 additions & 2 deletions lib/filterx/expr-null-coalesce.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct _FilterXNullCoalesce
};

static FilterXObject *
_eval(FilterXExpr *s)
_eval_null_coalesce(FilterXExpr *s)
{
FilterXNullCoalesce *self = (FilterXNullCoalesce *) s;

Expand Down Expand Up @@ -79,6 +79,6 @@ filterx_null_coalesce_new(FilterXExpr *lhs, FilterXExpr *rhs)

FilterXNullCoalesce *self = g_new0(FilterXNullCoalesce, 1);
filterx_binary_op_init_instance(&self->super, "null_coalesce", lhs, rhs);
self->super.super.eval = _eval;
self->super.super.eval = _eval_null_coalesce;
return &self->super.super;
}
6 changes: 3 additions & 3 deletions lib/filterx/expr-plus.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ typedef struct FilterXOperatorPlus
} FilterXOperatorPlus;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_plus(FilterXExpr *s)
{
FilterXOperatorPlus *self = (FilterXOperatorPlus *) s;

Expand Down Expand Up @@ -72,7 +72,7 @@ _optimize(FilterXExpr *s)
self->literal_rhs = filterx_expr_eval(self->super.rhs);

if (self->literal_lhs && self->literal_rhs)
return filterx_literal_new(_eval(&self->super.super));
return filterx_literal_new(_eval_plus(&self->super.super));
return NULL;
}

Expand All @@ -92,7 +92,7 @@ filterx_operator_plus_new(FilterXExpr *lhs, FilterXExpr *rhs)
FilterXOperatorPlus *self = g_new0(FilterXOperatorPlus, 1);
filterx_binary_op_init_instance(&self->super, "plus", lhs, rhs);
self->super.super.optimize = _optimize;
self->super.super.eval = _eval;
self->super.super.eval = _eval_plus;
self->super.super.free_fn = _filterx_operator_plus_free;

return &self->super.super;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-template.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ typedef struct _FilterXTemplate
} FilterXTemplate;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_template(FilterXExpr *s)
{
FilterXTemplate *self = (FilterXTemplate *) s;
FilterXEvalContext *context = filterx_eval_get_context();
Expand Down Expand Up @@ -72,7 +72,7 @@ filterx_template_new(LogTemplate *template)
FilterXTemplate *self = g_new0(FilterXTemplate, 1);

filterx_expr_init_instance(&self->super, "template");
self->super.eval = _eval;
self->super.eval = _eval_template;
self->super.free_fn = _free;
self->template = template;
return &self->super;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/expr-unset.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef struct FilterXExprUnset_
} FilterXExprUnset;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_unset(FilterXExpr *s)
{
FilterXExprUnset *self = (FilterXExprUnset *) s;

Expand Down Expand Up @@ -110,7 +110,7 @@ filterx_function_unset_new(FilterXFunctionArgs *args, GError **error)
FilterXExprUnset *self = g_new0(FilterXExprUnset, 1);
filterx_function_init_instance(&self->super, "unset");

self->super.super.eval = _eval;
self->super.super.eval = _eval_unset;
self->super.super.optimize = _optimize;
self->super.super.init = _init;
self->super.super.deinit = _deinit;
Expand Down
6 changes: 3 additions & 3 deletions lib/filterx/expr-variable.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ _whiteout_variable(FilterXVariableExpr *self, FilterXEvalContext *context)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_variable(FilterXExpr *s)
{
FilterXVariableExpr *self = (FilterXVariableExpr *) s;
FilterXEvalContext *context = filterx_eval_get_context();
Expand Down Expand Up @@ -182,7 +182,7 @@ filterx_variable_expr_new(FilterXString *name, FilterXVariableType type)

filterx_expr_init_instance(&self->super, "variable");
self->super.free_fn = _free;
self->super.eval = _eval;
self->super.eval = _eval_variable;
self->super._update_repr = _update_repr;
self->super.assign = _assign;
self->super.is_set = _isset;
Expand Down Expand Up @@ -215,6 +215,6 @@ filterx_variable_expr_declare(FilterXExpr *s)
{
FilterXVariableExpr *self = (FilterXVariableExpr *) s;

g_assert(s->eval == _eval);
g_assert(s->eval == _eval_variable);
self->declared = TRUE;
}
4 changes: 2 additions & 2 deletions lib/filterx/func-flatten.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ _flatten(FilterXFunctionFlatten *self, FilterXObject *dict)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_fx_flatten(FilterXExpr *s)
{
FilterXFunctionFlatten *self = (FilterXFunctionFlatten *) s;

Expand Down Expand Up @@ -282,7 +282,7 @@ filterx_function_flatten_new(FilterXFunctionArgs *args, GError **error)
{
FilterXFunctionFlatten *self = g_new0(FilterXFunctionFlatten, 1);
filterx_function_init_instance(&self->super, "flatten");
self->super.super.eval = _eval;
self->super.super.eval = _eval_fx_flatten;
self->super.super.init = _init;
self->super.super.deinit = _deinit;
self->super.super.free_fn = _free;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/func-istype.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ typedef struct FilterXFunctionIsType_
} FilterXFunctionIsType;

static FilterXObject *
_eval(FilterXExpr *s)
_eval_fx_istype(FilterXExpr *s)
{
FilterXFunctionIsType *self = (FilterXFunctionIsType *) s;

Expand Down Expand Up @@ -148,7 +148,7 @@ filterx_function_istype_new(FilterXFunctionArgs *args, GError **error)
{
FilterXFunctionIsType *self = g_new0(FilterXFunctionIsType, 1);
filterx_function_init_instance(&self->super, "istype");
self->super.super.eval = _eval;
self->super.super.eval = _eval_fx_istype;
self->super.super.init = _init;
self->super.super.deinit = _deinit;
self->super.super.free_fn = _free;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/func-sdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ _extract_args(FilterXFunctionIsSdataFromEnteprise *self, FilterXFunctionArgs *ar
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_fx_is_sdata_from(FilterXExpr *s)
{
FilterXFunctionIsSdataFromEnteprise *self = (FilterXFunctionIsSdataFromEnteprise *) s;

Expand Down Expand Up @@ -105,7 +105,7 @@ filterx_function_is_sdata_from_enterprise_new(FilterXFunctionArgs *args, GError

if (!_extract_args(self, args, error) || !filterx_function_args_check(args, error))
goto error;
self->super.super.eval = _eval;
self->super.super.eval = _eval_fx_is_sdata_from;
self->super.super.free_fn = _free;
filterx_function_args_free(args);
return &self->super.super;
Expand Down
4 changes: 2 additions & 2 deletions lib/filterx/func-set-fields.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ _process_field(Field *field, FilterXObject *dict)
}

static FilterXObject *
_eval(FilterXExpr *s)
_eval_fx_set_fields(FilterXExpr *s)
{
FilterXFunctionSetFields *self = (FilterXFunctionSetFields *) s;

Expand Down Expand Up @@ -457,7 +457,7 @@ filterx_function_set_fields_new(FilterXFunctionArgs *args, GError **error)
FilterXFunctionSetFields *self = g_new0(FilterXFunctionSetFields, 1);
filterx_function_init_instance(&self->super, "set_fields");

self->super.super.eval = _eval;
self->super.super.eval = _eval_fx_set_fields;
self->super.super.init = _init;
self->super.super.deinit = _deinit;
self->super.super.free_fn = _free;
Expand Down
Loading

0 comments on commit 3d96664

Please sign in to comment.