summaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/main.c b/main.c
index 3f82b460..c365a3c2 100644
--- a/main.c
+++ b/main.c
@@ -6,10 +6,7 @@
#include <unistd.h>
#include "compile.h"
#include "jv.h"
-#include "jv_file.h"
-#include "jv_parse.h"
-#include "execute.h"
-#include "config.h" /* Autoconf generated header file */
+#include "jq.h"
#include "jv_alloc.h"
#include "version.h"
@@ -260,8 +257,7 @@ int main(int argc, char* argv[]) {
slurped = jv_array();
}
}
- struct jv_parser parser;
- jv_parser_init(&parser);
+ struct jv_parser* parser = jv_parser_new();
char buf[4096];
while (read_more(buf, sizeof(buf))) {
if (options & RAW_INPUT) {
@@ -275,9 +271,9 @@ int main(int argc, char* argv[]) {
}
}
} else {
- jv_parser_set_buf(&parser, buf, strlen(buf), !feof(stdin));
+ jv_parser_set_buf(parser, buf, strlen(buf), !feof(stdin));
jv value;
- while (jv_is_valid((value = jv_parser_next(&parser)))) {
+ while (jv_is_valid((value = jv_parser_next(parser)))) {
if (options & SLURP) {
slurped = jv_array_append(slurped, value);
} else {
@@ -295,7 +291,7 @@ int main(int argc, char* argv[]) {
}
}
}
- jv_parser_free(&parser);
+ jv_parser_free(parser);
if (ret != 0)
goto out;
if (options & SLURP) {