summaryrefslogtreecommitdiffstats
path: root/libnetdata
diff options
context:
space:
mode:
authorthiagoftsm <thiagoftsm@gmail.com>2019-10-15 20:04:09 +0000
committerGitHub <noreply@github.com>2019-10-15 20:04:09 +0000
commitad8b796621e457a3eb5f5bb47518881fa100b470 (patch)
tree80a131ea7c7e2b2ecf0d97f900011d6fe7435080 /libnetdata
parent16d40fbb14f29e51902434a5da69932c4b0353a0 (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')
-rw-r--r--libnetdata/health/health.c2
-rw-r--r--libnetdata/json/json.c11
2 files changed, 4 insertions, 9 deletions
diff --git a/libnetdata/health/health.c b/libnetdata/health/health.c
index a70f284b1f..e03538db3f 100644
--- a/libnetdata/health/health.c
+++ b/libnetdata/health/health.c
@@ -112,7 +112,7 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
case JSON_OBJECT:
#ifndef ENABLE_JSONC
e->callback_function = health_silencers_json_read_callback;
- if(e->name && strcmp(e->name,"")) {
+ if(strcmp(e->name,"")) {
// init silencer
debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name);
#endif
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;
}