mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-03-25 13:17:38 +00:00
Get back in sync with json-pull
This commit is contained in:
parent
fd60cc6600
commit
b70d19288e
25
jsonpull.c
25
jsonpull.c
@ -58,29 +58,22 @@ json_pull *json_begin_file(FILE *f) {
|
||||
return json_begin(read_file, f);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int read_string(json_pull *j) {
|
||||
static int read_string(json_pull *j, char *buffer, int n) {
|
||||
char *cp = j->source;
|
||||
if (*cp == '\0') {
|
||||
return EOF;
|
||||
}
|
||||
int c = (unsigned char) *cp;
|
||||
j->source = cp + 1;
|
||||
return c;
|
||||
}
|
||||
int out = 0;
|
||||
|
||||
static int peek_string(json_pull *p) {
|
||||
char *cp = p->source;
|
||||
if (*cp == '\0') {
|
||||
return EOF;
|
||||
while (out < n && cp[out] != '\0') {
|
||||
buffer[out] = cp[out];
|
||||
out++;
|
||||
}
|
||||
return (unsigned char) *cp;
|
||||
|
||||
j->source = cp + out;
|
||||
return out;
|
||||
}
|
||||
|
||||
json_pull *json_begin_string(char *s) {
|
||||
return json_begin(read_string, peek_string, s);
|
||||
return json_begin(read_string, s);
|
||||
}
|
||||
#endif
|
||||
|
||||
void json_end(json_pull *p) {
|
||||
free(p->buffer);
|
||||
|
@ -48,10 +48,7 @@ typedef struct json_pull {
|
||||
} json_pull;
|
||||
|
||||
json_pull *json_begin_file(FILE *f);
|
||||
|
||||
#if 0
|
||||
json_pull *json_begin_string(char *s);
|
||||
#endif
|
||||
|
||||
json_pull *json_begin(int (*read)(struct json_pull *, char *buffer, int n), void *source);
|
||||
void json_end(json_pull *p);
|
||||
|
Loading…
x
Reference in New Issue
Block a user