aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-13 14:03:46 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-05-13 14:03:46 +0100
commit2d94c35b631d5d74bba56037a406bb125181e623 (patch)
treea60dbcc989b7b3bcab0a35fc5d899a109963ef48
parent3c7ecaaa01f7a49f7ffcaa0c533fbc97e9470700 (diff)
downloadrspamd-2d94c35b631d5d74bba56037a406bb125181e623.tar.gz
rspamd-2d94c35b631d5d74bba56037a406bb125181e623.zip
Add routine to check radix trie size.
-rw-r--r--src/libutil/radix.c10
-rw-r--r--src/libutil/radix.h7
2 files changed, 17 insertions, 0 deletions
diff --git a/src/libutil/radix.c b/src/libutil/radix.c
index 605d86668..3ca4c8716 100644
--- a/src/libutil/radix.c
+++ b/src/libutil/radix.c
@@ -642,6 +642,16 @@ radix_add_generic_iplist (const gchar *ip_list, radix_compressed_t **tree)
return (rspamd_radix_add_iplist (ip_list, ",; ", *tree) > 0);
}
+
+gsize
+radix_get_size (radix_compressed_t *tree)
+{
+ if (tree != NULL) {
+ return tree->size;
+ }
+
+ return 0;
+}
/*
* vi:ts=4
*/
diff --git a/src/libutil/radix.h b/src/libutil/radix.h
index 84d617305..a7ea7f868 100644
--- a/src/libutil/radix.h
+++ b/src/libutil/radix.h
@@ -97,4 +97,11 @@ gint rspamd_radix_add_iplist (const gchar *list, const gchar *separators,
gboolean radix_add_generic_iplist (const gchar *ip_list,
radix_compressed_t **tree);
+/**
+ * Returns number of elements in the tree
+ * @param tree
+ * @return
+ */
+gsize radix_get_size (radix_compressed_t *tree);
+
#endif