netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arturo Borrero <arturo.borrero.glez@gmail.com>
To: netfilter-devel@vger.kernel.org
Cc: pablo@netfilter.org
Subject: [libnftables PATCH] data_reg: Fix conditional code in XML parsing functions
Date: Tue, 28 May 2013 17:06:31 +0200	[thread overview]
Message-ID: <20130528150631.5282.3020.stgit@nfdev.cica.es> (raw)

All the XML parsing chunk was conditional but the main function. I think is better to
do the conditional compilation by function, returning -1 and setting errno = EOPNOTSUPP.


Signed-off-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
---
 src/expr/data_reg.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/expr/data_reg.c b/src/expr/data_reg.c
index 24497ff..be2b47a 100644
--- a/src/expr/data_reg.c
+++ b/src/expr/data_reg.c
@@ -25,9 +25,9 @@
 #include "data_reg.h"
 #include "internal.h"
 
-#ifdef XML_PARSING
 static int nft_data_reg_verdict_xml_parse(union nft_data_reg *reg, char *xml)
 {
+#ifdef XML_PARSING
 	mxml_node_t *tree = NULL;
 	mxml_node_t *node = NULL;
 	char *endptr;
@@ -76,12 +76,15 @@ static int nft_data_reg_verdict_xml_parse(union nft_data_reg *reg, char *xml)
 
 	mxmlDelete(tree);
 	return 0;
+#else
 	errno = EOPNOTSUPP;
 	return -1;
+#endif
 }
 
 static int nft_data_reg_chain_xml_parse(union nft_data_reg *reg, char *xml)
 {
+#ifdef XML_PARSING
 	mxml_node_t *tree = NULL;
 	mxml_node_t *node = NULL;
 
@@ -128,10 +131,15 @@ static int nft_data_reg_chain_xml_parse(union nft_data_reg *reg, char *xml)
 
 	mxmlDelete(tree);
 	return 0;
+#else
+	errno = EOPNOTSUPP;
+	return -1;
+#endif
 }
 
 static int nft_data_reg_value_xml_parse(union nft_data_reg *reg, char *xml)
 {
+#ifdef XML_PARSING
 	mxml_node_t *tree = NULL;
 	mxml_node_t *node = NULL;
 	int i, len;
@@ -211,10 +219,11 @@ static int nft_data_reg_value_xml_parse(union nft_data_reg *reg, char *xml)
 
 	mxmlDelete(tree);
 	return 0;
+#else
 	errno = EOPNOTSUPP;
 	return -1;
-}
 #endif
+}
 
 int nft_data_reg_xml_parse(union nft_data_reg *reg, char *xml)
 {


             reply	other threads:[~2013-05-28 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-28 15:06 Arturo Borrero [this message]
2013-05-29 12:12 ` [libnftables PATCH] data_reg: Fix conditional code in XML parsing functions Pablo Neira Ayuso

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=20130528150631.5282.3020.stgit@nfdev.cica.es \
    --to=arturo.borrero.glez@gmail.com \
    --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).