diff options
author | thiagoftsm <thiagoftsm@gmail.com> | 2019-10-15 20:04:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-15 20:04:09 +0000 |
commit | ad8b796621e457a3eb5f5bb47518881fa100b470 (patch) | |
tree | 80a131ea7c7e2b2ecf0d97f900011d6fe7435080 /libnetdata/json | |
parent | 16d40fbb14f29e51902434a5da69932c4b0353a0 (diff) |
Clang warnings (#7090)
* clang_warnings: Fix unecessary comparison
Netdata was verifying whether a pointer that will never be NULL could be NULL.
This commit removes this
* clang_warnings: Fix unecessary comparison
Netdata was doing another unecessary comparison in other file
* clang_warnings: Unecessary parenthesis
This commit removes the excess of parenthesis in a file
* clang_warnings: Remove unecessary initialization
Remove from json file a initial set that is overwritten few lines late
* clang_warnings: Comments
Fix comments on top of the function
* clang_warnings: Missing Cast
Volatile variable generates warnings with Clang sometimes, so it
was necessary to cast variables
* clang_warnings: Return from previous
Considering the possible problems given by the solution,
I am returning for the previous stage
Diffstat (limited to 'libnetdata/json')
-rw-r--r-- | libnetdata/json/json.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libnetdata/json/json.c b/libnetdata/json/json.c index 7c5adca3db..3ccc561c6f 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; } |