]> git.tuebingen.mpg.de Git - adu.git/blobdiff - bloom.c
bloom: Add some source documentation.
[adu.git] / bloom.c
diff --git a/bloom.c b/bloom.c
index f7a9b1aabd32f89863fa09f4c0121942df1b23f9..9b66b903be5d189704d0fedbac0cb07c70bd5113 100644 (file)
--- a/bloom.c
+++ b/bloom.c
@@ -114,13 +114,11 @@ int bloom_test_and_insert(const uint8_t *data, size_t len, struct bloom *b)
        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)
@@ -129,6 +127,12 @@ void bloom_free(struct bloom *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)
 {
@@ -145,6 +149,13 @@ int bloom_init(unsigned order, unsigned num_hash_functions,
 
 #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];