From 98a4e52b47311285d274e339d2c50a3d07a6f74e Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 15 Jun 2018 14:36:00 +0200 Subject: [PATCH] node: do not create config section in/out if not existant --- lib/node.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/node.c b/lib/node.c index 7b03c5317..7a8c02f99 100644 --- a/lib/node.c +++ b/lib/node.c @@ -241,12 +241,9 @@ int node_parse(struct node *n, json_t *json, const char *name) for (int j = 0; j < ARRAY_LEN(dirs); j++) { json_t *json_dir = json_object_get(json, dirs [j].str); - // Create empty object if not existing - if (!json_dir) { - json_dir = json_object(); - - json_object_set(json, dirs[j].str, json_dir); - } + // Skip if direction is unused + if (!json_dir) + json_dir = json_pack("{ s: b }", "enabled", 0); // Copy missing fields from main node config to direction config for (int i = 0; i < ARRAY_LEN(fields); i++) {