X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcurl_json_test.c;h=e8f8f6bb3a6c3a3cb8fd436890d3ee5d419b5819;hb=849f5394cce97a76da080f6cd9e5194b7f4ee0f0;hp=1e4d3b3bb0db7a96d151238a79e1c271591f36f9;hpb=6026e3162e522b133d10596710527d24c2921b55;p=collectd.git diff --git a/src/curl_json_test.c b/src/curl_json_test.c index 1e4d3b3b..e8f8f6bb 100644 --- a/src/curl_json_test.c +++ b/src/curl_json_test.c @@ -47,13 +47,15 @@ static cj_t *test_setup(char *json, char *key_path) { db->curl = (void *)cj_avl_create(); cj_key_t *key = calloc(1, sizeof(*key)); - key->magic = CJ_KEY_MAGIC; key->path = strdup(key_path); key->type = strdup("MAGIC"); assert(cj_append_key(db, key) == 0); - db->state[0].tree = db->tree; + cj_tree_entry_t root = {0}; + root.type = TREE; + root.tree = db->tree; + db->state[0].entry = &root; cj_curl_callback(json, strlen(json), 1, db); #if HAVE_YAJL_V2 @@ -62,6 +64,8 @@ static cj_t *test_setup(char *json, char *key_path) { yajl_parse_complete(db->yajl); #endif + db->state[0].entry = NULL; + return db; }