return !ret;
}
-int bloom_test_and_insert_string(const char *str, struct bloom *b)
-{
- uint32_t len = strlen(str);
-
- return bloom_test_and_insert((const uint8_t *)str, len, b);
-}
-
+/**
+ * Deallocate a bloom filter.
+ *
+ * \param b The filter to deallocate.
+ */
void bloom_free(struct bloom *b)
{
if (!b)
free(b);
}
+/**
+ * Initialize a bloom filter.
+ *
+ * \param order Use a filter containing 2^order bits.
+ * \param num_hash_functions Set that many bits in the filter per entry.
+ */
int bloom_init(unsigned order, unsigned num_hash_functions,
struct bloom **result)
{
#ifdef TEST_BLOOM
+int bloom_test_and_insert_string(const char *str, struct bloom *b)
+{
+ uint32_t len = strlen(str);
+
+ return bloom_test_and_insert((const uint8_t *)str, len, b);
+}
+
void add_stdin(struct bloom *b)
{
char buf[255];