From: Pierre-Yves Ritschard Date: Mon, 1 Dec 2014 07:49:00 +0000 (+0100) Subject: Merge pull request #411 from radford/curl-json-inhomogeneous-arrays X-Git-Tag: collectd-5.5.0~119 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dbeee0cfad69e701ea2665001fd9f2bce49c9489;p=collectd.git Merge pull request #411 from radford/curl-json-inhomogeneous-arrays curl_json plugin: don't complain about not finding expected maps in arrays --- dbeee0cfad69e701ea2665001fd9f2bce49c9489 diff --cc src/curl_json.c index e99500aa,b7eaf399..b79c999e --- a/src/curl_json.c +++ b/src/curl_json.c @@@ -231,17 -229,12 +231,17 @@@ static int cj_cb_number (void *ctx buffer[sizeof (buffer) - 1] = 0; if ((key == NULL) || !CJ_IS_KEY (key)) { - if (key != NULL) + if (key != NULL && !db->state[db->depth].in_array/*can be inhomogeneous*/) NOTICE ("curl_json plugin: Found \"%s\", but the configuration expects" " a map.", buffer); - cj_cb_inc_array_index (ctx, /* update_key = */ 0); - return (CJ_CB_CONTINUE); - } else { + cj_cb_inc_array_index (ctx, /* update_key = */ 1); + key = db->state[db->depth].key; + if (key == NULL) { + return (CJ_CB_CONTINUE); + } + } + else + { cj_cb_inc_array_index (ctx, /* update_key = */ 1); }