#include <stdio.h>
+#include <stdint.h>
#include <uthash.h>
#define SWAP(x, y) { x ^= y; y ^= x; x ^= y; }
void mark_point(int x, int y, struct entry **entries, int *r)
{
struct entry *p;
- struct point s = { .x=x, .y=y };
+ struct point s;
+ memset(&s, 0, sizeof s);
+ s.x = x;
+ s.y = y;
HASH_FIND(hh, *entries, &s, sizeof(struct point), p);
if (p) {
if (p->i++ == 1)
*r = *r+1;
} else {
- p = malloc(sizeof(struct entry));
+ p = calloc(1, sizeof(struct entry));
p->key = s;
p->i = 1;
HASH_ADD(hh, *entries, key, sizeof(struct point), p);
void mark_point(int x, int y, struct entry **entries, int *r)
{
struct entry *p;
- struct point s = {.x=x, .y=y};
+ struct point s;
+ memset(&s, 0, sizeof s);
+ s.x = x;
+ s.y = y;
HASH_FIND(hh, *entries, &s, sizeof(struct point), p);
if (p) {
if (p->i++ == 1)
*r = *r+1;
} else {
- p = malloc(sizeof(struct entry));
+ p = calloc(1, sizeof(struct entry));
p->key = s;
p->i = 1;
HASH_ADD(hh, *entries, key, sizeof(struct point), p);
clean:
$(RM) *.o a.out $(BINARIES)
+05%: CFLAGS+=-DHASH_BLOOM
+
run: $(addprefix run_,$(BINARIES))
run_%a: %a