Fix large features getting included multiple times at low zooms

This commit is contained in:
Eric Fischer
2014-09-23 17:18:36 -07:00
parent 8f77376b58
commit 95c2fb67b2
3 changed files with 38 additions and 2 deletions
+23 -2
View File
@@ -129,11 +129,11 @@ int indexcmp(const void *v1, const void *v2) {
}
}
struct pool_val *pool(struct pool *p, char *s, int type) {
struct pool_val *pool1(struct pool *p, char *s, int type, int (*compare)(const char *, const char *)) {
struct pool_val **v = &(p->vals);
while (*v != NULL) {
int cmp = strcmp(s, (*v)->s);
int cmp = compare(s, (*v)->s);
if (cmp == 0) {
cmp = type - (*v)->type;
@@ -167,6 +167,27 @@ struct pool_val *pool(struct pool *p, char *s, int type) {
return *v;
}
struct pool_val *pool(struct pool *p, char *s, int type) {
return pool1(p, s, type, strcmp);
}
int llcmp(const char *v1, const char *v2) {
long long *ll1 = (long long *) v1;
long long *ll2 = (long long *) v2;
if (*ll1 < *ll2) {
return -1;
} else if (*ll1 > *ll2) {
return 1;
} else {
return 0;
}
}
struct pool_val *pool_long_long(struct pool *p, long long *s, int type) {
return pool1(p, (char *) s, type, llcmp);
}
void pool_free(struct pool *p) {
while (p->head != NULL) {
struct pool_val *next = p->head->next;