netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nft v7 1/2] evaluate: New internal helper __expr_evaluate_range
@ 2019-08-18 18:20 Ander Juaristi
  2019-08-18 18:20 ` [PATCH nft v7 2/2] meta: Introduce new conditions 'time', 'day' and 'hour' Ander Juaristi
  2019-08-18 18:27 ` [PATCH nft v7 1/2] evaluate: New internal helper __expr_evaluate_range Florian Westphal
  0 siblings, 2 replies; 4+ messages in thread
From: Ander Juaristi @ 2019-08-18 18:20 UTC (permalink / raw)
  To: netfilter-devel

Signed-off-by: Ander Juaristi <a@juaristi.eus>
---
 src/evaluate.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/evaluate.c b/src/evaluate.c
index 831eb7c..a707f5e 100755
--- a/src/evaluate.c
+++ b/src/evaluate.c
@@ -941,16 +941,28 @@ static int expr_evaluate_range_expr(struct eval_ctx *ctx,
 	return 0;
 }
 
-static int expr_evaluate_range(struct eval_ctx *ctx, struct expr **expr)
+static int __expr_evaluate_range(struct eval_ctx *ctx, struct expr **expr)
 {
-	struct expr *range = *expr, *left, *right;
+	struct expr *range = *expr;
 
 	if (expr_evaluate_range_expr(ctx, range, &range->left) < 0)
 		return -1;
-	left = range->left;
-
 	if (expr_evaluate_range_expr(ctx, range, &range->right) < 0)
 		return -1;
+
+	return 0;
+}
+
+static int expr_evaluate_range(struct eval_ctx *ctx, struct expr **expr)
+{
+	struct expr *range = *expr, *left, *right;
+	int rc;
+
+	rc = __expr_evaluate_range(ctx, expr);
+	if (rc)
+		return rc;
+
+	left = range->left;
 	right = range->right;
 
 	if (mpz_cmp(left->value, right->value) >= 0)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-08-20 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-18 18:20 [PATCH nft v7 1/2] evaluate: New internal helper __expr_evaluate_range Ander Juaristi
2019-08-18 18:20 ` [PATCH nft v7 2/2] meta: Introduce new conditions 'time', 'day' and 'hour' Ander Juaristi
2019-08-20 13:41   ` Florian Westphal
2019-08-18 18:27 ` [PATCH nft v7 1/2] evaluate: New internal helper __expr_evaluate_range Florian Westphal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).