diff options
author | Nicolas Williams <nico@cryptonector.com> | 2013-04-28 18:33:45 -0500 |
---|---|---|
committer | Nicolas Williams <nico@cryptonector.com> | 2013-04-28 18:46:21 -0500 |
commit | 87e9c64003fdb13c629a3e0fbd3c6691a1967d7f (patch) | |
tree | 66fad4f19de10ac656998e3b6e7547a84d8f85cd /main.c | |
parent | 925ec3751f3b407c17412b0fa04a84fe39c1e0b7 (diff) |
Remove globals/make jq_init/next/teardown() an API
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -63,9 +63,10 @@ static int options = 0; static struct bytecode* bc; static void process(jv value) { - jq_init(bc, value); + jq_state *jq = NULL; + jq_init(bc, value, &jq); jv result; - while (jv_is_valid(result = jq_next())) { + while (jv_is_valid(result = jq_next(jq))) { if ((options & RAW_OUTPUT) && jv_get_kind(result) == JV_KIND_STRING) { fwrite(jv_string_value(result), 1, jv_string_length(jv_copy(result)), stdout); jv_free(result); @@ -85,7 +86,7 @@ static void process(jv value) { printf("\n"); } jv_free(result); - jq_teardown(); + jq_teardown(&jq); } static jv slurp_file(const char* filename) { |