From 5edd6bc75bbc53021d32b96fe5d3a18d4e633637 Mon Sep 17 00:00:00 2001 From: Nelson Kigen Date: Wed, 26 Feb 2014 19:38:10 +0100 Subject: [PATCH] New MACRO for creating jsontree_array This proposed MACRO simplifies jsontree_array declarations. It takes as arguments the name of the array and its size. ( I've modified the indention as requested ) --- apps/json/jsontree.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/json/jsontree.h b/apps/json/jsontree.h index 476487183..491e29ac9 100644 --- a/apps/json/jsontree.h +++ b/apps/json/jsontree.h @@ -115,6 +115,13 @@ struct jsontree_array { JSON_TYPE_OBJECT, \ sizeof(jsontree_pair_##name)/sizeof(struct jsontree_pair), \ jsontree_pair_##name } + +#define JSONTREE_ARRAY(name, count) \ + static struct jsontree_value *jsontree_value##name[count]; \ + static struct jsontree_array name = { \ + JSON_TYPE_ARRAY, \ + count, \ + jsontree_value##name } void jsontree_setup(struct jsontree_context *js_ctx, struct jsontree_value *root, int (* putchar)(int));