Skip to content

Commit

Permalink
Add flags argument to jv_parser_new()
Browse files Browse the repository at this point in the history
For extensibility.  We might add streaming parser options, even binary
JSON encoding options.
  • Loading branch information
nicowilliams committed Jun 4, 2014
1 parent ae625d0 commit d1ea3ab
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion jv.h
Expand Up @@ -140,7 +140,7 @@ void jv_nomem_handler(jv_nomem_handler_f, void *);
jv jv_load_file(const char *, int);

struct jv_parser;
struct jv_parser* jv_parser_new();
struct jv_parser* jv_parser_new(int);
void jv_parser_set_buf(struct jv_parser*, const char*, int, int);
jv jv_parser_next(struct jv_parser*);
void jv_parser_free(struct jv_parser*);
Expand Down
2 changes: 1 addition & 1 deletion jv_file.c
Expand Up @@ -18,7 +18,7 @@ jv jv_load_file(const char* filename, int raw) {
data = jv_string("");
} else {
data = jv_array();
parser = jv_parser_new();
parser = jv_parser_new(0);
}
while (!feof(file) && !ferror(file)) {
char buf[4096];
Expand Down
2 changes: 1 addition & 1 deletion jv_parse.c
Expand Up @@ -370,7 +370,7 @@ static pfunc scan(struct jv_parser* p, char ch, jv* out) {
return answer;
}

struct jv_parser* jv_parser_new() {
struct jv_parser* jv_parser_new(int flags) {
struct jv_parser* p = jv_mem_alloc(sizeof(struct jv_parser));
parser_init(p);
return p;
Expand Down
2 changes: 1 addition & 1 deletion main.c
Expand Up @@ -280,7 +280,7 @@ int main(int argc, char* argv[]) {
slurped = jv_array();
}
}
struct jv_parser* parser = jv_parser_new();
struct jv_parser* parser = jv_parser_new(0);
char buf[4096];
while (read_more(buf, sizeof(buf))) {
if (options & RAW_INPUT) {
Expand Down

0 comments on commit d1ea3ab

Please sign in to comment.