diff --git a/.bfilter.c.swo b/.bfilter.c.swo deleted file mode 100644 index 8d23e68..0000000 Binary files a/.bfilter.c.swo and /dev/null differ diff --git a/.bfilter.h.swo b/.bfilter.h.swo deleted file mode 100644 index 1504c24..0000000 Binary files a/.bfilter.h.swo and /dev/null differ diff --git a/.bfilter.py.swo b/.bfilter.py.swo deleted file mode 100644 index 104aa52..0000000 Binary files a/.bfilter.py.swo and /dev/null differ diff --git a/.gitignore b/.gitignore index 05debe1..0ee0321 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ test *swp +*swo diff --git a/bfilter.c b/bfilter.c index ab30c27..e21a3ed 100644 --- a/bfilter.c +++ b/bfilter.c @@ -2,7 +2,6 @@ #include #include #include - #include "bfilter.h" int @@ -30,7 +29,7 @@ bit_array_t* empty_bfilter(int size) { int width = (size/32) + 1; // 32 for a 32 bit int - uint32_t *barray = calloc(width, (sizeof (int))); + uint32_t *barray = calloc(width, sizeof (int)); bit_array_t *result = calloc(1, sizeof (bit_array_t)); @@ -44,7 +43,8 @@ empty_bfilter(int size) { int setbit(bit_array_t *arr, int k) { if ((uint32_t)k >= arr->num_elems) { - printf("Tried to set a bit beyond the current limit, limit = %zu, k = %d\nExiting...\n", arr->num_elems, k); + printf("Tried to set a bit beyond the current limit, limit = %zu, k = %d\nExiting...\n", + arr->num_elems, k); exit(1); } /* The position in the int we're looking at */ @@ -66,7 +66,8 @@ setbit(bit_array_t *arr, int k) { int unsetbit(bit_array_t *arr, int k) { if ((uint32_t)k >= arr->num_elems) { - printf("Tried to set a bit beyond the current limit, limit = %zu, k = %d\nExiting...\n", arr->num_elems, k); + printf("Tried to set a bit beyond the current limit, limit = %zu, k = %d\nExiting...\n", + arr->num_elems, k); exit(1); } int i = k/32; @@ -131,13 +132,13 @@ hash(const char *input, uint32_t k, size_t m) { fnv_hashes_t fnv = hash_fnv(input); if (k <= 2) { - hashes_t hashes = calloc(2, (sizeof (uint32_t))); + hashes_t hashes = calloc(2, sizeof (uint32_t)); hashes[0] = fnv.hash_1 % m; hashes[1] = fnv.hash_2 % m; return hashes; } - hashes_t hashes = calloc(k, (sizeof (uint32_t))); + hashes_t hashes = calloc(k, sizeof (uint32_t)); hashes[0] = fnv.hash_1 % m; hashes[1] = fnv.hash_2 % m; @@ -186,7 +187,6 @@ bfilter_get(bit_array_t *filter, int release_bfilter(bit_array_t *filter) { - printf("Releasing bloom filter\n"); free(filter->arr); free(filter); return 0; diff --git a/bfilter.o b/bfilter.o index 8e305aa..854ca79 100644 Binary files a/bfilter.o and b/bfilter.o differ diff --git a/bfilter.so b/bfilter.so index 97f9910..b088a14 100755 Binary files a/bfilter.so and b/bfilter.so differ