summaryrefslogtreecommitdiffstats
path: root/libnetdata/json/json.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-26 08:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-10-26 08:29:10 +0000
commit66ae4baad173098544603718e9864f0da1c0c7a3 (patch)
treed8e6f387ee9b4d9b6936e3c21208e50b86daea60 /libnetdata/json/json.c
parentAdding upstream version 1.18.0. (diff)
downloadnetdata-66ae4baad173098544603718e9864f0da1c0c7a3.tar.xz
netdata-66ae4baad173098544603718e9864f0da1c0c7a3.zip
Adding upstream version 1.18.1.upstream/1.18.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/json/json.c')
-rw-r--r--libnetdata/json/json.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/libnetdata/json/json.c b/libnetdata/json/json.c
index 7c5adca3d..3ccc561c6 100644
--- a/libnetdata/json/json.c
+++ b/libnetdata/json/json.c
@@ -284,18 +284,13 @@ size_t json_walk_primitive(char *js, jsmntok_t *t, size_t start, JSON_ENTRY *e)
* @param t the tokens
* @param nest the length of structure t
* @param start the first position
- * @param e the output structure.
+ * @param e the structure with values and callback to be used inside the function.
*
* @return It returns the array length
*/
size_t json_walk_array(char *js, jsmntok_t *t, size_t nest, size_t start, JSON_ENTRY *e)
{
- JSON_ENTRY ne = {
- .name = "",
- .fullname = "",
- .callback_data = NULL,
- .callback_function = NULL
- };
+ JSON_ENTRY ne;
char old = js[t[start].end];
js[t[start].end] = '\0';
@@ -315,7 +310,7 @@ size_t json_walk_array(char *js, jsmntok_t *t, size_t nest, size_t start, JSON_E
start++;
for(i = 0; i < size ; i++) {
ne.pos = i;
- if (!e->name || !e->fullname || strlen(e->name) > JSON_NAME_LEN - 24 || strlen(e->fullname) > JSON_FULLNAME_LEN -24) {
+ if (strlen(e->name) > JSON_NAME_LEN - 24 || strlen(e->fullname) > JSON_FULLNAME_LEN -24) {
info("JSON: JSON walk_array ignoring element with name:%s fullname:%s",e->name, e->fullname);
continue;
}