[PATCH nft 1/5] parser_json: move some code around

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

 



Place the helper earlier, next pach will call this from json_parse_cmd.

Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
---
 src/parser_json.c | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/src/parser_json.c b/src/parser_json.c
index ff52423af4d7..d4cc2c1e4e9c 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -63,6 +63,17 @@ struct json_ctx {
 #define is_DTYPE(ctx)	(ctx->flags & CTX_F_DTYPE)
 #define is_SET_RHS(ctx)	(ctx->flags & CTX_F_SET_RHS)
 
+struct json_cmd_assoc {
+	struct json_cmd_assoc *next;
+	struct hlist_node hnode;
+	const struct cmd *cmd;
+	json_t *json;
+};
+
+#define CMD_ASSOC_HSIZE		512
+static struct hlist_head json_cmd_assoc_hash[CMD_ASSOC_HSIZE];
+static struct json_cmd_assoc *json_cmd_assoc_list;
+
 static char *ctx_flags_to_string(struct json_ctx *ctx)
 {
 	static char buf[1024];
@@ -4089,6 +4100,17 @@ static struct cmd *json_parse_cmd_rename(struct json_ctx *ctx,
 	return cmd;
 }
 
+static void json_cmd_assoc_add(json_t *json, const struct cmd *cmd)
+{
+	struct json_cmd_assoc *new = xzalloc(sizeof *new);
+
+	new->json	= json;
+	new->cmd	= cmd;
+	new->next	= json_cmd_assoc_list;
+
+	json_cmd_assoc_list = new;
+}
+
 static struct cmd *json_parse_cmd(struct json_ctx *ctx, json_t *root)
 {
 	struct {
@@ -4141,17 +4163,6 @@ static int json_verify_metainfo(struct json_ctx *ctx, json_t *root)
 	return 0;
 }
 
-struct json_cmd_assoc {
-	struct json_cmd_assoc *next;
-	struct hlist_node hnode;
-	const struct cmd *cmd;
-	json_t *json;
-};
-
-#define CMD_ASSOC_HSIZE		512
-static struct hlist_head json_cmd_assoc_hash[CMD_ASSOC_HSIZE];
-static struct json_cmd_assoc *json_cmd_assoc_list;
-
 static void json_cmd_assoc_free(void)
 {
 	struct json_cmd_assoc *cur;
@@ -4173,17 +4184,6 @@ static void json_cmd_assoc_free(void)
 	}
 }
 
-static void json_cmd_assoc_add(json_t *json, const struct cmd *cmd)
-{
-	struct json_cmd_assoc *new = xzalloc(sizeof *new);
-
-	new->json	= json;
-	new->cmd	= cmd;
-	new->next	= json_cmd_assoc_list;
-
-	json_cmd_assoc_list = new;
-}
-
 static json_t *seqnum_to_json(const uint32_t seqnum)
 {
 	struct json_cmd_assoc *cur;
-- 
2.43.0





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux