X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fnum_exp.c;h=36be5f35ea92c4f3ec71d7350df366bf35b6172f;hp=72f374e521b09f1a5b3a509b182bfc56edc8c757;hb=216e7ac3b97aed5a5d65c511dc061c78be90e79d;hpb=09529efcde471127419e141807b83b37077003a0 diff --git a/src/types/num_exp.c b/src/types/num_exp.c index 72f374e..36be5f3 100644 --- a/src/types/num_exp.c +++ b/src/types/num_exp.c @@ -36,7 +36,7 @@ struct psi_num_exp *psi_num_exp_init_ternary(token_t op, struct psi_num_exp *cond, struct psi_num_exp *truthy, struct psi_num_exp *falsy) { - struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + struct psi_num_exp *exp = pecalloc(1, sizeof(*exp), 1); exp->op = op; exp->data.t.cond = cond; @@ -49,7 +49,7 @@ struct psi_num_exp *psi_num_exp_init_ternary(token_t op, struct psi_num_exp *psi_num_exp_init_binary(token_t op, struct psi_num_exp *lhs, struct psi_num_exp *rhs) { - struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + struct psi_num_exp *exp = pecalloc(1, sizeof(*exp), 1); exp->op = op; exp->data.b.lhs = lhs; @@ -61,7 +61,7 @@ struct psi_num_exp *psi_num_exp_init_binary(token_t op, struct psi_num_exp *psi_num_exp_init_unary(token_t op, struct psi_num_exp *u) { - struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + struct psi_num_exp *exp = pecalloc(1, sizeof(*exp), 1); exp->op = op; exp->data.u = u; @@ -71,7 +71,7 @@ struct psi_num_exp *psi_num_exp_init_unary(token_t op, struct psi_num_exp *psi_num_exp_init_num(struct psi_number *n) { - struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + struct psi_num_exp *exp = pecalloc(1, sizeof(*exp), 1); exp->op = PSI_T_NUMBER; exp->data.n = n; @@ -82,7 +82,7 @@ struct psi_num_exp *psi_num_exp_init_num(struct psi_number *n) struct psi_num_exp *psi_num_exp_init_cast(struct psi_decl_type *typ, struct psi_num_exp *num) { - struct psi_num_exp *exp = calloc(1, sizeof(*exp)); + struct psi_num_exp *exp = pecalloc(1, sizeof(*exp), 1); exp->op = PSI_T_CAST; exp->data.c.typ = typ; @@ -99,7 +99,7 @@ struct psi_num_exp *psi_num_exp_copy(struct psi_num_exp *exp) return NULL; } - cpy = malloc(sizeof(*cpy)); + cpy = pemalloc(sizeof(*cpy), 1); *cpy = *exp; switch (exp->op) {