From: Nicolas Williams Date: Fri, 26 Dec 2014 20:37:38 +0000 (-0600) Subject: Allow C-coded functions to `empty` X-Git-Tag: jq-1.5rc1~27 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=906d2537b9d0384985ed6259ef77ca1bd3d503ed;p=jq Allow C-coded functions to `empty` Just return a jv_invalid() without a message. --- diff --git a/execute.c b/execute.c index e8fba19..231bd21 100644 --- a/execute.c +++ b/execute.c @@ -703,9 +703,13 @@ jv jq_next(jq_state *jq) { if (jv_is_valid(top)) { stack_push(jq, top); - } else { + } else if (jv_invalid_has_msg(jv_copy(top))) { set_error(jq, top); goto do_backtrack; + } else { + // C-coded function returns invalid w/o msg? -> backtrack, as if + // it had returned `empty` + goto do_backtrack; } break; }