@@ -271,12 +271,11 @@ static int jq_util_input_read_more(jq_util_input_state *state) {
271271 fclose (state -> current_input );
272272 }
273273 state -> current_input = NULL ;
274- jv_free (state -> current_filename );
275- state -> current_filename = jv_invalid ();
276- state -> current_line = 0 ;
277274 }
278275 const char * f = next_file (state );
279276 if (f != NULL ) {
277+ jv_free (state -> current_filename );
278+ state -> current_line = 0 ;
280279 if (!strcmp (f , "-" )) {
281280 state -> current_input = stdin ;
282281 state -> current_filename = jv_string ("<stdin>" );
@@ -288,7 +287,6 @@ static int jq_util_input_read_more(jq_util_input_state *state) {
288287 state -> failures ++ ;
289288 }
290289 }
291- state -> current_line = 0 ;
292290 }
293291 }
294292
@@ -344,8 +342,7 @@ static int jq_util_input_read_more(jq_util_input_state *state) {
344342 }
345343 }
346344 }
347- return state -> curr_file == state -> nfiles &&
348- (!state -> current_input || feof (state -> current_input ) || ferror (state -> current_input ));
345+ return state -> curr_file == state -> nfiles && !state -> current_input ;
349346}
350347
351348jv jq_util_input_next_input_cb (jq_state * jq , void * data ) {
@@ -399,7 +396,6 @@ jv jq_util_input_get_current_line(jq_state* jq) {
399396// When slurping, it returns just one value
400397jv jq_util_input_next_input (jq_util_input_state * state ) {
401398 int is_last = 0 ;
402- int has_more = 0 ;
403399 jv value = jv_invalid (); // need more input
404400 do {
405401 if (state -> parser == NULL ) {
@@ -429,10 +425,6 @@ jv jq_util_input_next_input(jq_util_input_state *state) {
429425 }
430426 value = jv_parser_next (state -> parser );
431427 if (jv_is_valid (state -> slurped )) {
432- // When slurping an input that doesn't have a trailing newline,
433- // we might have more than one value on the same line, so let's check
434- // to see if we have more data to parse.
435- has_more = jv_parser_remaining (state -> parser );
436428 if (jv_is_valid (value )) {
437429 state -> slurped = jv_array_append (state -> slurped , value );
438430 value = jv_invalid ();
@@ -442,7 +434,7 @@ jv jq_util_input_next_input(jq_util_input_state *state) {
442434 return value ;
443435 }
444436 }
445- } while (!is_last || has_more );
437+ } while (!is_last );
446438
447439 if (jv_is_valid (state -> slurped )) {
448440 value = state -> slurped ;
0 commit comments