diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2022-11-15 23:49:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-15 23:49:42 +0200 |
commit | becd97a3660af34104c557ba6c2877f624143c2e (patch) | |
tree | 14fa78305bd8c27bf1fa06c9c346b8f7a8a1d721 /libnetdata/dictionary | |
parent | 1789d07c43182152437459a7a4f81267bbdd752c (diff) |
Revert "New journal disk based indexing for agent memory reduction" (#14000)
Revert "New journal disk based indexing for agent memory reduction (#13885)"
This reverts commit 224b051a2b2bab39a4b536e531ab9ca590bf31bb.
Diffstat (limited to 'libnetdata/dictionary')
-rw-r--r-- | libnetdata/dictionary/dictionary.c | 9 | ||||
-rw-r--r-- | libnetdata/dictionary/dictionary.h | 8 |
2 files changed, 5 insertions, 12 deletions
diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c index 29456200a9..e362acdd8b 100644 --- a/libnetdata/dictionary/dictionary.c +++ b/libnetdata/dictionary/dictionary.c @@ -2171,13 +2171,11 @@ int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const D // ---------------------------------------------------------------------------- // sorted walkthrough -typedef int (*qsort_compar)(const void *item1, const void *item2); - static int dictionary_sort_compar(const void *item1, const void *item2) { return strcmp(item_get_name((*(DICTIONARY_ITEM **)item1)), item_get_name((*(DICTIONARY_ITEM **)item2))); } -int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *entry, void *data), void *data, dictionary_sorted_compar compar) { +int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *entry, void *data), void *data) { if(unlikely(!dict || !callback)) return 0; if(unlikely(is_dictionary_destroyed(dict))) { @@ -2202,10 +2200,7 @@ int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)( if(unlikely(i != entries)) entries = i; - if(compar) - qsort(array, entries, sizeof(DICTIONARY_ITEM *), (qsort_compar)compar); - else - qsort(array, entries, sizeof(DICTIONARY_ITEM *), dictionary_sort_compar); + qsort(array, entries, sizeof(DICTIONARY_ITEM *), dictionary_sort_compar); bool callit = true; int ret = 0, r; diff --git a/libnetdata/dictionary/dictionary.h b/libnetdata/dictionary/dictionary.h index 4e2ba751fa..d002385cb3 100644 --- a/libnetdata/dictionary/dictionary.h +++ b/libnetdata/dictionary/dictionary.h @@ -230,11 +230,9 @@ size_t dictionary_acquired_item_references(DICT_ITEM_CONST DICTIONARY_ITEM *item #define dictionary_walkthrough_write(dict, callback, data) dictionary_walkthrough_rw(dict, 'w', callback, data) int dictionary_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *value, void *data), void *data); -typedef int (*dictionary_sorted_compar)(const DICTIONARY_ITEM **item1, const DICTIONARY_ITEM **item2); - -#define dictionary_sorted_walkthrough_read(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'r', callback, data, NULL) -#define dictionary_sorted_walkthrough_write(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'w', callback, data, NULL) -int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *entry, void *data), void *data, dictionary_sorted_compar compar); +#define dictionary_sorted_walkthrough_read(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'r', callback, data) +#define dictionary_sorted_walkthrough_write(dict, callback, data) dictionary_sorted_walkthrough_rw(dict, 'w', callback, data) +int dictionary_sorted_walkthrough_rw(DICTIONARY *dict, char rw, int (*callback)(const DICTIONARY_ITEM *item, void *entry, void *data), void *data); // ---------------------------------------------------------------------------- // Traverse with foreach |