summaryrefslogtreecommitdiffhomepage
path: root/eval.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-09-08 20:12:39 +0200
committerJo-Philipp Wich <jo@mein.io>2020-09-08 20:12:39 +0200
commitc735882bb492ff81f98773186652dbe878ff3d60 (patch)
tree4cbfadecef27402605a00298222c223f8ccccb51 /eval.c
parent42e8fcddf0ec78d81d6733c8a14592df9dcb2381 (diff)
parser, eval: use an ut_op flag to denote postfix access
The current code still abused the JSON value pointer to denote postfix access for certain operations which led to a crash when freeing the parser state due to an attempt to put a (void *)1 pointer. Since we do have the ability to set flags on operations since the AST rework, use this much cleaner approach and avoid the invalid pointer hackery. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 4bcc2b2..d2099dd 100644
--- a/eval.c
+++ b/eval.c
@@ -804,7 +804,7 @@ ut_execute_inc_dec(struct ut_state *state, uint32_t off)
ut_putval(ut_setval(scope, key, nval));
/* postfix inc/dec, return old val */
- if (op->val)
+ if (op->is_postfix)
return val;
ut_putval(val);
@@ -1292,7 +1292,7 @@ ut_execute_op(struct ut_state *state, uint32_t off)
case T_LBRACK:
/* postfix access */
- if (op->val) {
+ if (op->is_postfix) {
scope = ut_getref_required(state, off, &key);
state->ctx = scope;