X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;ds=sidebyside;f=src%2Ftypes%2Fassert_stmt.c;h=9ded0ee9910d3669bf45e05232c7f85f8658c7ef;hb=2fa436074ca9a5e87f39b696de832fa2188fcfc6;hp=ba86758d70254cc18c32b826d0b38e0b11cc93f3;hpb=6509a2053456d0e63b6f383b757289d3016ed1a5;p=m6w6%2Fext-psi diff --git a/src/types/assert_stmt.c b/src/types/assert_stmt.c index ba86758..9ded0ee 100644 --- a/src/types/assert_stmt.c +++ b/src/types/assert_stmt.c @@ -43,12 +43,10 @@ void psi_assert_stmt_free(struct psi_assert_stmt **stmt_ptr) if (*stmt_ptr) { struct psi_assert_stmt *stmt = *stmt_ptr; + *stmt_ptr = NULL; psi_num_exp_free(&stmt->exp); - if (stmt->token) { - free(stmt->token); - } + psi_token_free(&stmt->token); free(stmt); - *stmt_ptr = NULL; } } @@ -68,14 +66,14 @@ bool psi_assert_stmt_exec(struct psi_assert_stmt *stmt, struct psi_call_frame *f return chk.u8; } -bool psi_assert_stmts_validate(struct psi_data *data, struct psi_impl *impl) +bool psi_assert_stmts_validate(struct psi_data *data, struct psi_validate_scope *scope) { size_t i = 0; struct psi_assert_stmt *ass; /* we can have multiple assert stmts */ - while (psi_plist_get(impl->stmts.ass, i++, &ass)) { - if (!psi_num_exp_validate(data, ass->exp, impl, NULL, NULL, NULL, NULL)) { + while (psi_plist_get(scope->impl->stmts.ass, i++, &ass)) { + if (!psi_num_exp_validate(data, ass->exp, scope)) { return false; } }