struct psi_assert_stmt *psi_assert_stmt_init(enum psi_assert_kind kind, struct psi_num_exp *exp)
{
- struct psi_assert_stmt *stmt = calloc(1, sizeof(*stmt));
+ struct psi_assert_stmt *stmt = pecalloc(1, sizeof(*stmt), 1);
stmt->kind = kind;
stmt->exp = exp;
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;
}
}
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;
}
}
dprintf(fd, "Failed asserting that ");
psi_num_exp_dump(fd, stmt->exp);
fstat(fd, &sb);
- message = malloc(sb.st_size + 1);
+ message = pemalloc(sb.st_size + 1, 1);
lseek(fd, 0, SEEK_SET);
read(fd, message, sb.st_size);
close(fd);