summaryrefslogtreecommitdiffstats
path: root/libnetdata/dictionary/dictionary.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:19:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-03-09 13:20:02 +0000
commit58daab21cd043e1dc37024a7f99b396788372918 (patch)
tree96771e43bb69f7c1c2b0b4f7374cb74d7866d0cb /libnetdata/dictionary/dictionary.c
parentReleasing debian version 1.43.2-1. (diff)
downloadnetdata-58daab21cd043e1dc37024a7f99b396788372918.tar.xz
netdata-58daab21cd043e1dc37024a7f99b396788372918.zip
Merging upstream version 1.44.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata/dictionary/dictionary.c')
-rw-r--r--libnetdata/dictionary/dictionary.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c
index 2d5313c3..45922abf 100644
--- a/libnetdata/dictionary/dictionary.c
+++ b/libnetdata/dictionary/dictionary.c
@@ -422,7 +422,7 @@ static inline void DICTIONARY_ENTRIES_MINUS1(DICTIONARY *dict) {
size_t entries; (void)entries;
if(unlikely(is_dictionary_single_threaded(dict))) {
dict->version++;
- entries = dict->entries++;
+ entries = dict->entries--;
}
else {
__atomic_fetch_add(&dict->version, 1, __ATOMIC_RELAXED);
@@ -2627,7 +2627,7 @@ static char **dictionary_unittest_generate_names(size_t entries) {
char **names = mallocz(sizeof(char *) * entries);
for(size_t i = 0; i < entries ;i++) {
char buf[25 + 1] = "";
- snprintfz(buf, 25, "name.%zu.0123456789.%zu!@#$%%^&*(),./[]{}\\|~`", i, entries / 2 + i);
+ snprintfz(buf, sizeof(buf) - 1, "name.%zu.0123456789.%zu!@#$%%^&*(),./[]{}\\|~`", i, entries / 2 + i);
names[i] = strdupz(buf);
}
return names;
@@ -2637,7 +2637,7 @@ static char **dictionary_unittest_generate_values(size_t entries) {
char **values = mallocz(sizeof(char *) * entries);
for(size_t i = 0; i < entries ;i++) {
char buf[25 + 1] = "";
- snprintfz(buf, 25, "value-%zu-0987654321.%zu%%^&*(),. \t !@#$/[]{}\\|~`", i, entries / 2 + i);
+ snprintfz(buf, sizeof(buf) - 1, "value-%zu-0987654321.%zu%%^&*(),. \t !@#$/[]{}\\|~`", i, entries / 2 + i);
values[i] = strdupz(buf);
}
return values;
@@ -3253,13 +3253,13 @@ static void *unittest_dict_thread(void *arg) {
char buf [256 + 1];
for (int i = 0; i < 1000; i++) {
- snprintfz(buf, 256, "del/flush test %d", i);
+ snprintfz(buf, sizeof(buf) - 1, "del/flush test %d", i);
dictionary_set(tu->dict, buf, NULL, 0);
tu->stats.ops.inserts++;
}
for (int i = 0; i < 1000; i++) {
- snprintfz(buf, 256, "del/flush test %d", i);
+ snprintfz(buf, sizeof(buf) - 1, "del/flush test %d", i);
dictionary_del(tu->dict, buf);
tu->stats.ops.deletes++;
}