[libnftables PATCH] data_reg: Fix conditional code in XML parsing functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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)
 {

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux