Skip to content

Commit

Permalink
Short-circuit in _p_update as soon as a disabled branch is found
Browse files Browse the repository at this point in the history
  • Loading branch information
sideeffect42 committed Feb 8, 2024
1 parent e3e8bb4 commit 6681e6a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ygpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,14 @@ function eval_shell_cmd(cmd, _k) {
}

function _p_update(p_name, _i, _s) {
# NOTE: values > 0 are considered true
_s = 1
for (_i = 1; _i <= p_stacks[p_name, "p_last"]; ++_i)
_s = _s && p_stacks[p_name, _i]
for (_i = 1; _i <= p_stacks[p_name, "p_last"]; ++_i) {
if (0 >= p_stacks[p_name, _i]) {
_s = 0
break
}
}
p_stacks[p_name, "p_state"] = _s
}

Expand Down

0 comments on commit 6681e6a

Please sign in to comment.