summaryrefslogtreecommitdiffstats
path: root/src/table.c
diff options
context:
space:
mode:
authorÁlvaro Neira Ayuso <alvaroneay@gmail.com>2013-07-31 15:20:59 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2013-07-31 16:42:53 +0200
commit03e3740d654e1e14ccfb8dbfaba605ae72067ef6 (patch)
treee9f05c32b12a61e8e44dc4daf5df08478c4f7aed /src/table.c
parent72ba595e37a73c539aa64d22b2dace3e5bbea3bc (diff)
jansson: Add helper function for building the tree and use it
Add a helper function that parses and returns the jansson tree, use it in the table parser. Signed-off-by: Alvaro Neira Ayuso <alvaroneay@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/table.c')
-rw-r--r--src/table.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/src/table.c b/src/table.c
index 1f4fe76..526f3e7 100644
--- a/src/table.c
+++ b/src/table.c
@@ -290,17 +290,9 @@ static int nft_table_json_parse(struct nft_table *t, char *json)
const char *str;
int family;
- root = json_loadb(json, strlen(json), 0, &error);
- if (!root) {
- errno = EINVAL;
- goto err;
- }
-
- root = json_object_get(root, "table");
- if (root == NULL) {
- errno = EINVAL;
- goto err;
- }
+ root = nft_jansson_get_root(json, "table", &error);
+ if (root == NULL)
+ return -1;
str = nft_jansson_value_parse_str(root, "name");
if (str == NULL)