Skip to content

Commit

Permalink
src/main.c: fix issue #1587 by using jv_dumpf in the raw-output and a…
Browse files Browse the repository at this point in the history
…scii-output case. retain fwrite in the raw-output case.
  • Loading branch information
rain-1 authored and nicowilliams committed Mar 1, 2018
1 parent ae11f11 commit bf88c73
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ static int process(jq_state *jq, jv value, int flags, int dumpopts) {
jv result;
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_bytes(jv_copy(result)), stdout);
if (options & ASCII_OUTPUT) {
jv_dumpf(result, stdout, JV_PRINT_ASCII);

This comment has been minimized.

Copy link
@leonid-s-usov

leonid-s-usov Nov 8, 2018

Contributor

jv_copy(result) is needed here

} else {
fwrite(jv_string_value(result), 1, jv_string_length_bytes(jv_copy(result)), stdout);
}
ret = 0;
jv_free(result);
} else {
Expand Down

0 comments on commit bf88c73

Please sign in to comment.