From 3f994836f6bb124a5c0185ab6659ef7f57ceac5f Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Thu, 25 Jul 2013 21:21:51 +0200 Subject: src: xml: consolidate common XML code via nft_mxml_str_parse This patch moves common XML string parsing code to nft_mxml_str_parse(). Signed-off-by: Pablo Neira Ayuso --- src/expr/lookup.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/expr/lookup.c') diff --git a/src/expr/lookup.c b/src/expr/lookup.c index b9a803e..d66577b 100644 --- a/src/expr/lookup.c +++ b/src/expr/lookup.c @@ -147,16 +147,14 @@ nft_rule_expr_lookup_xml_parse(struct nft_rule_expr *e, mxml_node_t *tree) { #ifdef XML_PARSING struct nft_expr_lookup *lookup = nft_expr_data(e); - mxml_node_t *node = NULL; + const char *set_name; int32_t reg; - /* get and set . Is mandatory */ - node = mxmlFindElement(tree, tree, "set", NULL, NULL, - MXML_DESCEND_FIRST); - if (node == NULL) + set_name = nft_mxml_str_parse(tree, "set", MXML_DESCEND_FIRST); + if (set_name == NULL) return -1; - memcpy(lookup->set_name, node->child->value.opaque, IFNAMSIZ); + strncpy(lookup->set_name, set_name, IFNAMSIZ); lookup->set_name[IFNAMSIZ-1] = '\0'; e->flags |= (1 << NFT_EXPR_LOOKUP_SET); -- cgit v1.2.3