From c5780deadbda31d4a76e7f4ded866d769c2a1151 Mon Sep 17 00:00:00 2001 From: Haru Date: Thu, 15 Sep 2016 15:29:16 +0200 Subject: Fixed some issues detected by clang's static analyzer (Xcode 8/macOS Sierra) Signed-off-by: Haru --- src/common/HPM.c | 2 +- src/common/socket.c | 4 ---- src/common/timer.c | 4 ---- 3 files changed, 1 insertion(+), 9 deletions(-) (limited to 'src/common') diff --git a/src/common/HPM.c b/src/common/HPM.c index c34828010..ff1371b14 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -898,7 +898,7 @@ bool hplugins_parse_conf(const struct config_t *config, const char *filename, en for (i = 0; i < VECTOR_LENGTH(HPM->config_listeners[point]); i++) { const struct HPConfListenStorage *entry = &VECTOR_INDEX(HPM->config_listeners[point], i); const char *config_name = entry->key; - const char *str = buf; + const char *str = NULL; if ((setting = libconfig->lookup(config, config_name)) == NULL) { if (!imported && entry->required) { ShowWarning("Missing configuration '%s' in file %s!\n", config_name, filename); diff --git a/src/common/socket.c b/src/common/socket.c index 5f284587a..d4b8bb43f 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -1023,10 +1023,6 @@ int do_sockets(int next) } } -#ifdef __clang_analyzer__ - // Let Clang's static analyzer know this never happens (it thinks it might because of a NULL check in session_is_valid) - if (!sockt->session[i]) continue; -#endif // __clang_analyzer__ sockt->session[i]->func_parse(i); if(!sockt->session[i]) diff --git a/src/common/timer.c b/src/common/timer.c index 0b28f6a06..f820ebe12 100644 --- a/src/common/timer.c +++ b/src/common/timer.c @@ -258,10 +258,6 @@ int64 timer_gettick(void) { /// Adds a timer to the timer_heap static void push_timer_heap(int tid) { BHEAP_ENSURE(timer_heap, 1, 256); -#ifdef __clang_analyzer__ // Clang's static analyzer warns that BHEAP_ENSURE might set BHEAP_DATA(timer_heap) to NULL. -#include "assert.h" - assert(BHEAP_DATA(timer_heap) != NULL); -#endif // __clang_analyzer__ BHEAP_PUSH(timer_heap, tid, DIFFTICK_MINTOPCMP, swap); } -- cgit v1.2.3-60-g2f50