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