Skip to content

Commit

Permalink
filterx/expr-comparison: use typed values for comparisons
Browse files Browse the repository at this point in the history
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
  • Loading branch information
bazsi committed Jun 6, 2024
1 parent ee6232f commit 1e5c22c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/filterx/expr-comparison.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ _evaluate_type_aware(FilterXObject *lhs, FilterXObject *rhs, gint operator)
(filterx_object_is_type(lhs, &FILTERX_TYPE_NAME(string)) ||
filterx_object_is_type(lhs, &FILTERX_TYPE_NAME(bytes)) ||
filterx_object_is_type(lhs, &FILTERX_TYPE_NAME(protobuf)) ||
filterx_object_is_type(lhs, &FILTERX_TYPE_NAME(message_value)) ||
filterx_object_is_type(lhs, &FILTERX_TYPE_NAME(json_object)) || // TODO: we should have generic map and array cmp
filterx_object_is_type(lhs, &FILTERX_TYPE_NAME(json_array))))
return _evaluate_as_string(lhs, rhs, operator);
Expand Down Expand Up @@ -184,11 +183,11 @@ _eval(FilterXExpr *s)
{
FilterXComparison *self = (FilterXComparison *) s;

FilterXObject *lhs_object = filterx_expr_eval(self->super.lhs);
FilterXObject *lhs_object = filterx_expr_eval_typed(self->super.lhs);
if (!lhs_object)
return NULL;

FilterXObject *rhs_object = filterx_expr_eval(self->super.rhs);
FilterXObject *rhs_object = filterx_expr_eval_typed(self->super.rhs);
if (!rhs_object)
{
filterx_object_unref(lhs_object);
Expand Down

0 comments on commit 1e5c22c

Please sign in to comment.