Skip to content

Commit

Permalink
makes jq functions borrow-save
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxBrandtner committed Feb 29, 2024
1 parent 715b4b4 commit 791b76d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/execute.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void stack_push(jq_state *jq, jv val) {
assert(jv_is_valid(val));
jq->stk_top = stack_push_block(&jq->stk, jq->stk_top, sizeof(jv));
jv* sval = stack_block(&jq->stk, jq->stk_top);
*sval = val;
*sval = jv_return(val);
}

jv stack_pop(jq_state *jq) {
Expand Down Expand Up @@ -1274,7 +1274,7 @@ jv jq_get_lib_dirs(jq_state *jq) {
void jq_set_attrs(jq_state *jq, jv attrs) {
assert(jv_get_kind(attrs) == JV_KIND_OBJECT);
jv_free(jq->attrs);
jq->attrs = attrs;
jq->attrs = jv_return(attrs);
}

void jq_set_attr(jq_state *jq, jv attr, jv val) {
Expand Down Expand Up @@ -1324,8 +1324,8 @@ jq_halt(jq_state *jq, jv exit_code, jv error_message)
{
assert(!jq->halted);
jq->halted = 1;
jq->exit_code = exit_code;
jq->error_message = error_message;
jq->exit_code = jv_return(exit_code);
jq->error_message = jv_return(error_message);
}

int
Expand Down

0 comments on commit 791b76d

Please sign in to comment.