netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] erec: Make error messages in nft consistent
@ 2016-11-16 22:03 Elise Lennion
  0 siblings, 0 replies; only message in thread
From: Elise Lennion @ 2016-11-16 22:03 UTC (permalink / raw)
  To: pablo; +Cc: netfilter-devel

Error messages in nft from parser_bison should state "syntax error" to
keep consistency. A new error type was defined to include this message.

Signed-off-by: Elise Lennion <elise.lennion@gmail.com>
---
 v2: Create new error_record_type instead of modify the message within
 the error_record struct.
 v3: Separate changes in different patches

 include/erec.h | 5 ++++-
 src/erec.c     | 3 ++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/erec.h b/include/erec.h
index 36e0efa..8fee151 100644
--- a/include/erec.h
+++ b/include/erec.h
@@ -15,6 +15,7 @@ enum error_record_types {
 	EREC_INFORMATIONAL,
 	EREC_WARNING,
 	EREC_ERROR,
+	EREC_SYNTAX_ERROR,
 };
 
 #define EREC_MSGBUFSIZE		1024
@@ -47,8 +48,10 @@ extern struct error_record *erec_create(enum error_record_types type,
 extern void erec_add_location(struct error_record *erec,
 			      const struct location *loc);
 
-#define error(loc, fmt, args...) \
+#define __error(loc, fmt, args...) \
 	erec_create(EREC_ERROR, (loc), (fmt), ## args)
+#define error(loc, fmt, args...) \
+	erec_create(EREC_SYNTAX_ERROR, (loc), (fmt), ## args)
 #define warning(loc, fmt, args...) \
 	erec_create(EREC_WARNING, (loc), (fmt), ## args)
 
diff --git a/src/erec.c b/src/erec.c
index 3603216..9f01238 100644
--- a/src/erec.c
+++ b/src/erec.c
@@ -30,7 +30,8 @@ const struct location internal_location = {
 static const char *error_record_names[] = {
 	[EREC_INFORMATIONAL]	= NULL,
 	[EREC_WARNING]		= "Warning",
-	[EREC_ERROR]		= "Error"
+	[EREC_ERROR]		= "Error",
+	[EREC_SYNTAX_ERROR]     = "Error: syntax error"
 };
 
 void erec_add_location(struct error_record *erec, const struct location *loc)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-11-16 22:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-16 22:03 [PATCH v3 1/2] erec: Make error messages in nft consistent Elise Lennion

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).