mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-02 01:08:14 +00:00
Drag constant pool handling into C++
This commit is contained in:
parent
3d56a56464
commit
3f3a341c0a
@ -1,7 +1,10 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "pool.h"
|
|
||||||
|
extern "C" {
|
||||||
|
#include "pool.h"
|
||||||
|
}
|
||||||
|
|
||||||
#define POOL_WIDTH 256
|
#define POOL_WIDTH 256
|
||||||
|
|
||||||
@ -34,7 +37,7 @@ struct pool_val *pool(struct pool *p, const char *s, int type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pool_val *nv = malloc(sizeof(struct pool_val));
|
struct pool_val *nv = (struct pool_val *) malloc(sizeof(struct pool_val));
|
||||||
if (nv == NULL) {
|
if (nv == NULL) {
|
||||||
fprintf(stderr, "out of memory making string pool\n");
|
fprintf(stderr, "out of memory making string pool\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -109,7 +112,7 @@ void pool_free_strings(struct pool *p) {
|
|||||||
|
|
||||||
void pool_init(struct pool *p, int n) {
|
void pool_init(struct pool *p, int n) {
|
||||||
p->n = n;
|
p->n = n;
|
||||||
p->vals = calloc(POOL_WIDTH, sizeof(struct pool_val *));
|
p->vals = (struct pool_val **) calloc(POOL_WIDTH, sizeof(struct pool_val *));
|
||||||
if (p->vals == NULL) {
|
if (p->vals == NULL) {
|
||||||
fprintf(stderr, "out of memory creating string pool\n");
|
fprintf(stderr, "out of memory creating string pool\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
Loading…
x
Reference in New Issue
Block a user