Browse Source

don't use lmaa because the problem was static linking

master
wes 7 years ago
parent
commit
f6b3b9d53a
  1. 4
      Makefile
  2. 9
      bfilter.c

4
Makefile

@ -1,6 +1,6 @@
default: bfilter.c bfilter.h
$(CC) -g -Wall -Wextra -std=gnu99 -Wpointer-arith -Wmissing-prototypes -lmaa -lfnv -lm -L. -O0 ./bfilter.c -o test -Wl,-rpath,/home/wes/bfilter;
$(CC) -g -Wall -Wextra -std=gnu99 -Wpointer-arith -Wmissing-prototypes -lfnv -lm -L. -O0 ./bfilter.c -o test -Wl,-rpath,/home/wes/bfilter;
lib: bfilter.c bfilter.h
$(CC) -g -DLIB -c -fpic -Wall -Wextra -pedantic -Wpointer-arith -Werror -std=c99 -lmaa -lfnv -lm -L. -O0 ./bfilter.c -Wl,-rpath,/home/wes/bfilter;
$(CC) -g -DLIB -c -fpic -Wall -Wextra -pedantic -Wpointer-arith -Werror -std=c99 -lfnv -lm -L. -O0 ./bfilter.c -Wl,-rpath,/home/wes/bfilter;
$(CC) -shared -o bfilter.so bfilter.o;

9
bfilter.c

@ -2,7 +2,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <fnv.h>
#include <maa.h>
#include "bfilter.h"
@ -31,9 +30,9 @@ bit_array_t*
empty_bfilter(int size) {
int width = (size/32) + 1; // 32 for a 32 bit int
uint32_t *barray = xcalloc(width, (sizeof (int)));
uint32_t *barray = calloc(width, (sizeof (int)));
bit_array_t *result = xcalloc(1, sizeof (bit_array_t));
bit_array_t *result = calloc(1, sizeof (bit_array_t));
result->arr = barray;
result->num_ints = width;
@ -132,13 +131,13 @@ hash(const char *input, uint32_t k, size_t m) {
fnv_hashes_t fnv = hash_fnv(input);
if (k <= 2) {
hashes_t hashes = xcalloc(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 = xcalloc(k, (sizeof (uint32_t)));
hashes_t hashes = calloc(k, (sizeof (uint32_t)));
hashes[0] = fnv.hash_1 % m;
hashes[1] = fnv.hash_2 % m;

Loading…
Cancel
Save