X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Ftypes%2Fconst.c;h=627707078b289af3a4365c18234070f55befb08b;hb=788909f4828147d22a822b736560c1b3643417ec;hp=1a06e431eb3358492362b6cba62ab82449b7d9cb;hpb=2fa436074ca9a5e87f39b696de832fa2188fcfc6;p=m6w6%2Fext-psi diff --git a/src/types/const.c b/src/types/const.c index 1a06e43..6277070 100644 --- a/src/types/const.c +++ b/src/types/const.c @@ -29,7 +29,7 @@ struct psi_const *psi_const_init(struct psi_impl_type *type, zend_string *name, struct psi_impl_def_val *val) { - struct psi_const *c = calloc(1, sizeof(*c)); + struct psi_const *c = pecalloc(1, sizeof(*c), 1); if (name->val[0] == '\\') { c->name = zend_string_init(&name->val[1], name->len-1, 1); @@ -55,13 +55,15 @@ void psi_const_free(struct psi_const **constant_ptr) } } -void psi_const_dump(int fd, struct psi_const *cnst) +void psi_const_dump(struct psi_dump *dump, struct psi_const *cnst) { - dprintf(fd, "const "); - psi_impl_type_dump(fd, cnst->type); - dprintf(fd, " %s = ", cnst->name->val); - psi_impl_def_val_dump(fd, cnst->val); - dprintf(fd, ";"); + PSI_DUMP(dump, "const "); + if (cnst->type) { + psi_impl_type_dump(dump, cnst->type); + } + PSI_DUMP(dump, " %s = ", cnst->name->val); + psi_impl_def_val_dump(dump, cnst->val); + PSI_DUMP(dump, ";"); } bool psi_const_validate(struct psi_data *data, struct psi_const *c,