aboutsummaryrefslogtreecommitdiff
path: root/src/util/container_bloomfilter.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-21 15:17:49 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-21 15:17:49 +0000
commit78f1dafee3986e034c680affc6171e83e36a6688 (patch)
tree27ed4006f0c7781635ec79455fb0ff93d3c5dbf2 /src/util/container_bloomfilter.c
parent4440df3d5ddffe5038b0354075e85c18fee57f3a (diff)
downloadgnunet-78f1dafee3986e034c680affc6171e83e36a6688.tar.gz
gnunet-78f1dafee3986e034c680affc6171e83e36a6688.zip
simplified OR2 API
Diffstat (limited to 'src/util/container_bloomfilter.c')
-rw-r--r--src/util/container_bloomfilter.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c
index d6c2cb8b9..c21342f59 100644
--- a/src/util/container_bloomfilter.c
+++ b/src/util/container_bloomfilter.c
@@ -774,22 +774,27 @@ GNUNET_CONTAINER_bloomfilter_or (struct GNUNET_CONTAINER_BloomFilter *bf,
774 * 774 *
775 * @param bf the filter 775 * @param bf the filter
776 * @param to_or the bloomfilter to or-in 776 * @param to_or the bloomfilter to or-in
777 * @param size number of bytes in data 777 * @return #GNUNET_OK on success
778 */ 778 */
779int 779int
780GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf, 780GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
781 const struct GNUNET_CONTAINER_BloomFilter 781 const struct GNUNET_CONTAINER_BloomFilter
782 *to_or, size_t size) 782 *to_or)
783{ 783{
784 unsigned int i; 784 unsigned int i;
785 unsigned int n; 785 unsigned int n;
786 unsigned long long *fc; 786 unsigned long long *fc;
787 const unsigned long long *dc; 787 const unsigned long long *dc;
788 size_t size;
788 789
789 if (NULL == bf) 790 if (NULL == bf)
790 return GNUNET_YES; 791 return GNUNET_OK;
791 if (bf->bitArraySize != size) 792 if (bf->bitArraySize != to_or->bitArraySize)
793 {
794 GNUNET_break (0);
792 return GNUNET_SYSERR; 795 return GNUNET_SYSERR;
796 }
797 size = bf->bitArraySize;
793 fc = (unsigned long long *) bf->bitArray; 798 fc = (unsigned long long *) bf->bitArray;
794 dc = (const unsigned long long *) to_or->bitArray; 799 dc = (const unsigned long long *) to_or->bitArray;
795 n = size / sizeof (unsigned long long); 800 n = size / sizeof (unsigned long long);
@@ -801,6 +806,7 @@ GNUNET_CONTAINER_bloomfilter_or2 (struct GNUNET_CONTAINER_BloomFilter *bf,
801 return GNUNET_OK; 806 return GNUNET_OK;
802} 807}
803 808
809
804/** 810/**
805 * Remove an element from the filter. 811 * Remove an element from the filter.
806 * 812 *