#include <payload.h>
#include <expression.h>
+struct eval_recursion {
+ uint16_t binop;
+};
+
/**
* struct eval_ctx - evaluation context
*
* @set: current set
* @stmt: current statement
* @stmt_len: current statement template length
- * @recursion: expr evaluation recursion counter
+ * @recursion: expr evaluation recursion counters
* @cache: cache context
* @debug_mask: debugging bitmask
* @ectx: expression context
struct set *set;
struct stmt *stmt;
uint32_t stmt_len;
- uint32_t recursion;
+ struct eval_recursion recursion;
struct expr_ctx ectx;
struct proto_ctx _pctx[2];
const struct proto_desc *inner_desc;
unsigned int max_shift_len = ctx->ectx.len;
int ret = -1;
- if (ctx->recursion >= USHRT_MAX)
+ if (ctx->recursion.binop >= USHRT_MAX)
return expr_binary_error(ctx->msgs, op, NULL,
"Binary operation limit %u reached ",
- ctx->recursion);
- ctx->recursion++;
+ ctx->recursion.binop);
+ ctx->recursion.binop++;
if (expr_evaluate(ctx, &op->left) < 0)
return -1;
}
- if (ctx->recursion == 0)
+ if (ctx->recursion.binop == 0)
BUG("recursion counter underflow");
/* can't check earlier: evaluate functions might do constant-merging + expr_free.
* So once we've evaluate everything check for remaining length of the
* binop chain.
*/
- if (--ctx->recursion == 0) {
+ if (--ctx->recursion.binop == 0) {
unsigned int to_linearize = 0;
op = *expr;