aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/lc-btrie
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-01 11:09:37 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-01 11:09:37 +0100
commitfcaf800bd6cddb56c1cd88044346996d1f8854ee (patch)
tree2a77eadcfb5a8d24ad8c08f1bcc131502d777485 /contrib/lc-btrie
parentb45bc487b77ad51e3cf25ad9f0b19334c821cc6f (diff)
downloadrspamd-fcaf800bd6cddb56c1cd88044346996d1f8854ee.tar.gz
rspamd-fcaf800bd6cddb56c1cd88044346996d1f8854ee.zip
[Feature] Suppress duplicate warning on very large radix tries
Diffstat (limited to 'contrib/lc-btrie')
-rw-r--r--contrib/lc-btrie/btrie.c8
-rw-r--r--contrib/lc-btrie/btrie.h2
2 files changed, 6 insertions, 4 deletions
diff --git a/contrib/lc-btrie/btrie.c b/contrib/lc-btrie/btrie.c
index fe768fc56..b1c66f1c3 100644
--- a/contrib/lc-btrie/btrie.c
+++ b/contrib/lc-btrie/btrie.c
@@ -1485,7 +1485,7 @@ static size_t count_free(const struct btrie *btrie)
#endif /* not NDEBUG */
const char *
-btrie_stats(const struct btrie *btrie)
+btrie_stats(const struct btrie *btrie, guint duplicates)
{
static char buf[128];
size_t n_nodes = btrie->n_lc_nodes + btrie->n_tbm_nodes;
@@ -1530,8 +1530,10 @@ btrie_stats(const struct btrie *btrie)
, average_depth, (long unsigned)stats.max_depth);
#else
snprintf(buf, sizeof(buf),
- "ents=%lu tbm=%lu lc=%lu mem=%.0fk free=%lu waste=%lu"
- ,(long unsigned)btrie->n_entries, (long unsigned)btrie->n_tbm_nodes,
+ "ents=%lu dup=%u tbm=%lu lc=%lu mem=%.0fk free=%lu waste=%lu",
+ (long unsigned)btrie->n_entries,
+ duplicates,
+ (long unsigned)btrie->n_tbm_nodes,
(long unsigned)btrie->n_lc_nodes, (double)btrie->alloc_total / 1024,
(long unsigned)alloc_free, (long unsigned)btrie->alloc_waste
);
diff --git a/contrib/lc-btrie/btrie.h b/contrib/lc-btrie/btrie.h
index 2cc662961..370a03e51 100644
--- a/contrib/lc-btrie/btrie.h
+++ b/contrib/lc-btrie/btrie.h
@@ -70,7 +70,7 @@ enum btrie_result btrie_add_prefix(struct btrie *btrie,
const void *btrie_lookup(const struct btrie *btrie, const btrie_oct_t *pfx,
unsigned len);
-const char *btrie_stats(const struct btrie *btrie);
+const char *btrie_stats(const struct btrie *btrie, guint duplicates);
#ifndef NO_MASTER_DUMP
typedef void btrie_walk_cb_t(const btrie_oct_t *prefix, unsigned len,