/* TODO: use malloc_large */
- ibf = GNUNET_malloc (sizeof (struct InvertibleBloomFilter));
+ ibf = GNUNET_new (struct InvertibleBloomFilter);
ibf->count = GNUNET_malloc (size * sizeof (uint8_t));
ibf->key_sum = GNUNET_malloc (size * sizeof (struct IBF_Key));
ibf->key_hash_sum = GNUNET_malloc (size * sizeof (struct IBF_KeyHash));
/**
- * Insert an element into an IBF.
+ * Insert a key into an IBF.
*
* @param ibf the IBF
* @param key the element's hash code
ibf_insert_into (ibf, key, buckets, 1);
}
+
+/**
+ * Remove a key from an IBF.
+ *
+ * @param ibf the IBF
+ * @param key the element's hash code
+ */
+void
+ibf_remove (struct InvertibleBloomFilter *ibf, struct IBF_Key key)
+{
+ int buckets[ibf->hash_num];
+ GNUNET_assert (ibf->hash_num <= ibf->size);
+ ibf_get_indices (ibf, key, buckets);
+ ibf_insert_into (ibf, key, buckets, -1);
+}
+
+
/**
* Test is the IBF is empty, i.e. all counts, keys and key hashes are zero.
*/