diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2022-07-18 20:39:29 +0300 |
---|---|---|
committer | Costa Tsaousis <costa@netdata.cloud> | 2022-07-18 20:39:29 +0300 |
commit | 269b941be777f6d79b0c07d42f388ad7010fea7e (patch) | |
tree | 1922440ae68c4812e8e90d6e0ae3a7b2564ab042 | |
parent | 688f58304ed56a4f9c219369548e02de600fdc8c (diff) |
fixed codacy suggestions
-rw-r--r-- | database/rrdcontext.c | 6 | ||||
-rw-r--r-- | database/rrdlabels.c | 2 | ||||
-rw-r--r-- | libnetdata/dictionary/dictionary.c | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/database/rrdcontext.c b/database/rrdcontext.c index 9d06dbc5ea..ca92630107 100644 --- a/database/rrdcontext.c +++ b/database/rrdcontext.c @@ -1204,6 +1204,7 @@ static void rrdcontext_message_send_unsafe(RRDCONTEXT *rc, bool snapshot __maybe rc->hub.last_time_t = rrd_flag_is_collected(rc) ? 0 : rc->last_time_t; rc->hub.deleted = (rc->flags & RRD_FLAG_DELETED) ? true : false; +#ifdef ENABLE_ACLK struct context_updated message = { .id = rc->hub.id, .version = rc->hub.version, @@ -1217,7 +1218,6 @@ static void rrdcontext_message_send_unsafe(RRDCONTEXT *rc, bool snapshot __maybe .deleted = rc->hub.deleted, }; -#ifdef ENABLE_ACLK if(snapshot) contexts_snapshot_add_ctx_update(bundle, &message); else @@ -1388,7 +1388,7 @@ static STRING *string_2way_merge(RRDCONTEXT *rc __maybe_unused, STRING *a, STRIN size_t alen = string_length(a); size_t blen = string_length(b); size_t length = alen + blen + string_length(X) + 1; - char buf1[length + 1], buf2[length + 1], *dst1, *dst2; + char buf1[length + 1], buf2[length + 1], *dst1; const char *s1, *s2; s1 = string2str(a); @@ -1406,7 +1406,7 @@ static STRING *string_2way_merge(RRDCONTEXT *rc __maybe_unused, STRING *a, STRIN s1 = &(string2str(a))[alen - 1]; s2 = &(string2str(b))[blen - 1]; - dst2 = &buf2[length]; + char *dst2 = &buf2[length]; *dst2 = '\0'; for (; *s1 && *s2 && *s1 == *s2; s1--, s2--) *(--dst2) = *s1; diff --git a/database/rrdlabels.c b/database/rrdlabels.c index aa03f630ae..5198cb4aae 100644 --- a/database/rrdlabels.c +++ b/database/rrdlabels.c @@ -373,6 +373,7 @@ static size_t rrdlabels_sanitize(unsigned char *dst, const unsigned char *src, s if(unlikely(!dst_size)) return 0; if(unlikely(!src || !*src)) { strncpyz((char *)dst, empty, dst_size); + dst[dst_size - 1] = '\0'; return strlen((char *)dst); } @@ -454,6 +455,7 @@ static size_t rrdlabels_sanitize(unsigned char *dst, const unsigned char *src, s if(unlikely(*dst == '\0')) { strncpyz((char *)dst, empty, dst_size); + dst[dst_size - 1] = '\0'; return strlen((char *)dst); } diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c index 4dd872b206..122262b9f8 100644 --- a/libnetdata/dictionary/dictionary.c +++ b/libnetdata/dictionary/dictionary.c @@ -897,7 +897,7 @@ size_t dictionary_destroy(DICTIONARY *dict) { dict->entries); dictionary_unlock(dict, DICTIONARY_LOCK_WRITE); - usleep(10000); + sleep_usec(10000); } } while(referenced_items > 0 && ++retries < 10); |