summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-26 15:37:11 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-04-26 15:37:11 +0100
commit5cf3888a94c98f617a2287cd5e92139abcc85f64 (patch)
tree685ce9cc8251a874bb4a03f76f7598c3166e5168
parent6338432f8b061e866c3782b45c03dccfe4681669 (diff)
downloadrspamd-5cf3888a94c98f617a2287cd5e92139abcc85f64.tar.gz
rspamd-5cf3888a94c98f617a2287cd5e92139abcc85f64.zip
[Minor] Store number of elements in maps
-rw-r--r--src/libutil/map_helpers.c3
-rw-r--r--src/libutil/map_private.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/src/libutil/map_helpers.c b/src/libutil/map_helpers.c
index b7d6acb49..574017bda 100644
--- a/src/libutil/map_helpers.c
+++ b/src/libutil/map_helpers.c
@@ -795,6 +795,7 @@ rspamd_kv_list_fin (struct map_cb_data *data)
htb = (struct rspamd_hash_map_helper *)data->cur_data;
msg_info_map ("read hash of %d elements", kh_size (htb->htb));
data->map->traverse_function = rspamd_map_helper_traverse_hash;
+ data->map->nelts = kh_size (htb->htb);
}
}
@@ -838,6 +839,7 @@ rspamd_radix_fin (struct map_cb_data *data)
msg_info_map ("read radix trie of %z elements: %s",
radix_get_size (r->trie), radix_get_info (r->trie));
data->map->traverse_function = rspamd_map_helper_traverse_radix;
+ data->map->nelts = kh_size (r->htb);
}
}
@@ -1016,6 +1018,7 @@ rspamd_regexp_list_fin (struct map_cb_data *data)
msg_info_map ("read regexp list of %ud elements",
re_map->regexps->len);
data->map->traverse_function = rspamd_map_helper_traverse_regexp;
+ data->map->nelts = kh_size (re_map->htb);
}
}
diff --git a/src/libutil/map_private.h b/src/libutil/map_private.h
index eea616591..0720aa2e8 100644
--- a/src/libutil/map_private.h
+++ b/src/libutil/map_private.h
@@ -118,6 +118,7 @@ struct rspamd_map {
gpointer dtor_data;
rspamd_map_traverse_function traverse_function;
gpointer lua_map;
+ gsize nelts;
/* Should we check HTTP or just load cached data */
struct timeval tv;
gdouble poll_timeout;