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

init utilizes calloc which malloc and memset.

need cherry-pick commit of libbloom
This commit is contained in:
babarosaM33
2020-01-29 18:57:19 +08:00
parent b6a83d9497
commit a5005664a7
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -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;