Browse Source

ppbloom: save free() and subsequent init() overhead

init utilizes calloc which malloc and memset.

need cherry-pick commit of libbloom
pull/2610/head
babarosaM33 4 years ago
parent
commit
a5005664a7
2 changed files with 2 additions and 3 deletions
  1. 2
      libbloom
  2. 3
      src/ppbloom.c

2
libbloom

@ -1 +1 @@
Subproject commit 7a9deb893fc1646c0b9186b50d46358379953d4b
Subproject commit 437e1add5a2b9a87797d8c648df7cf5f3ee155a8

3
src/ppbloom.c

@ -88,8 +88,7 @@ ppbloom_add(const void *buffer, int len)
if (bloom_count[current] >= entries) {
bloom_count[current] = 0;
current = current == PING ? PONG : PING;
bloom_free(ppbloom + current);
bloom_init(ppbloom + current, entries, error);
bloom_reset(ppbloom + current);
}
return 0;

Loading…
Cancel
Save