From: Patrick McHardy <kaber@trash.net>
To: pablo@netfilter.org
Cc: netfilter-devel@vger.kernel.org
Subject: [PATCH 1/3] expr: make expr_binary_error() usable outside of evaluation
Date: Fri, 7 Mar 2014 10:28:39 +0100 [thread overview]
Message-ID: <1394184521-11419-2-git-send-email-kaber@trash.net> (raw)
In-Reply-To: <1394184521-11419-1-git-send-email-kaber@trash.net>
Turn the eval_ctx argument into a list_head to queue the error to.
Signed-off-by: Patrick McHardy <kaber@trash.net>
---
include/expression.h | 6 +++---
src/expression.c | 4 ++--
src/payload.c | 8 ++++----
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/expression.h b/include/expression.h
index ac6a4f4..354e679 100644
--- a/include/expression.h
+++ b/include/expression.h
@@ -268,12 +268,12 @@ extern void expr_set_type(struct expr *expr, const struct datatype *dtype,
enum byteorder byteorder);
struct eval_ctx;
-extern int expr_binary_error(struct eval_ctx *ctx,
+extern int expr_binary_error(struct list_head *msgs,
const struct expr *e1, const struct expr *e2,
const char *fmt, ...) __gmp_fmtstring(4, 5);
-#define expr_error(ctx, expr, fmt, args...) \
- expr_binary_error(ctx, expr, NULL, fmt, ## args)
+#define expr_error(msgs, expr, fmt, args...) \
+ expr_binary_error(msgs, expr, NULL, fmt, ## args)
static inline bool expr_is_constant(const struct expr *expr)
{
diff --git a/src/expression.c b/src/expression.c
index adaf6e7..cdc2b7b 100644
--- a/src/expression.c
+++ b/src/expression.c
@@ -127,7 +127,7 @@ const struct datatype *expr_basetype(const struct expr *expr)
return type;
}
-int __fmtstring(4, 5) expr_binary_error(struct eval_ctx *ctx,
+int __fmtstring(4, 5) expr_binary_error(struct list_head *msgs,
const struct expr *e1, const struct expr *e2,
const char *fmt, ...)
{
@@ -139,7 +139,7 @@ int __fmtstring(4, 5) expr_binary_error(struct eval_ctx *ctx,
if (e2 != NULL)
erec_add_location(erec, &e2->location);
va_end(ap);
- erec_queue(erec, ctx->msgs);
+ erec_queue(erec, msgs);
return -1;
}
diff --git a/src/payload.c b/src/payload.c
index a312e07..9f2db6d 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -154,12 +154,12 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
if (expr->payload.base < h->base) {
if (expr->payload.base < h->base - 1)
- return expr_error(ctx, expr,
+ return expr_error(ctx->msgs, expr,
"payload base is invalid for this "
"family");
if (proto_dev_type(expr->payload.desc, &type) < 0)
- return expr_error(ctx, expr,
+ return expr_error(ctx->msgs, expr,
"protocol specification is invalid "
"for this family");
@@ -181,14 +181,14 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
desc = &proto_inet_service;
if (desc == NULL)
- return expr_error(ctx, expr,
+ return expr_error(ctx->msgs, expr,
"ambiguous payload specification: "
"no %s protocol specified",
proto_base_names[expr->payload.base - 1]);
protocol = proto_find_num(desc, expr->payload.desc);
if (protocol < 0)
- return expr_error(ctx, expr,
+ return expr_error(ctx->msgs, expr,
"conflicting protocols specified: %s vs. %s",
desc->name, expr->payload.desc->name);
--
1.8.5.3
next prev parent reply other threads:[~2014-03-07 9:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-07 9:28 [PATCH 0/3] nftables: fix segtree interval conflict reporting Patrick McHardy
2014-03-07 9:28 ` Patrick McHardy [this message]
2014-03-07 9:28 ` [PATCH 2/3] expr: add comparison function for singleton expressions Patrick McHardy
2014-03-07 9:28 ` [PATCH 3/3] set: abort on interval conflicts Patrick McHardy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394184521-11419-2-git-send-email-kaber@trash.net \
--to=kaber@trash.net \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).