@cryptotaxi247 / netdata-1 / commits / ad8b79662

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

thiagoftsm committed Oct 15, 2019 at 20:04 UTC ad8b796621e457a3eb5f5bb47518881fa100b470
3 files changed +5 -10
libnetdata/health/health.c
+1 -1
@@ -112,7 +112,7 @@ int health_silencers_json_read_callback(JSON_ENTRY *e)
112 case JSON_OBJECT:
113 #ifndef ENABLE_JSONC
114 e->callback_function = health_silencers_json_read_callback;
115 - if(e->name && strcmp(e->name,"")) {
115 + if(strcmp(e->name,"")) {
116 // init silencer
117 debug(D_HEALTH, "JSON: Got object with a name, initializing new silencer for %s",e->name);
118 #endif
libnetdata/json/json.c
+3 -8
@@ -284,18 +284,13 @@ size_t json_walk_primitive(char *js, jsmntok_t *t, size_t start, JSON_ENTRY *e)
284 * @param t the tokens
285 * @param nest the length of structure t
286 * @param start the first position
287 - * @param e the output structure.
287 + * @param e the structure with values and callback to be used inside the function.
288 *
289 * @return It returns the array length
290 */
291 size_t json_walk_array(char *js, jsmntok_t *t, size_t nest, size_t start, JSON_ENTRY *e)
292 {
293 - JSON_ENTRY ne = {
294 - .name = "",
295 - .fullname = "",
296 - .callback_data = NULL,
297 - .callback_function = NULL
298 - };
293 + JSON_ENTRY ne;
294
295 char old = js[t[start].end];
296 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
310 start++;
311 for(i = 0; i < size ; i++) {
312 ne.pos = i;
318 - if (!e->name || !e->fullname || strlen(e->name) > JSON_NAME_LEN - 24 || strlen(e->fullname) > JSON_FULLNAME_LEN -24) {
313 + if (strlen(e->name) > JSON_NAME_LEN - 24 || strlen(e->fullname) > JSON_FULLNAME_LEN -24) {
314 info("JSON: JSON walk_array ignoring element with name:%s fullname:%s",e->name, e->fullname);
315 continue;
316 }
web/api/queries/query.c
+1 -1
@@ -1559,7 +1559,7 @@ RRDR *rrd2rrdr(
1559 rrd_update_every, first_entry_t,
1560 last_entry_t);
1561 #ifdef ENABLE_DBENGINE
1562 - if ((st->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE)) {
1562 + if (st->rrd_memory_mode == RRD_MEMORY_MODE_DBENGINE) {
1563 struct rrdeng_region_info *region_info_array;
1564 unsigned regions, max_interval;
1565