X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Ftypes%2Fimpl_type.c;h=e4ace47e69ed74326508025b3493eb188ec00b7f;hb=cd0567b4052ee24259bc6b8a9858af9d26f3de48;hp=25b1f1f5f254ae302b0260305cd9846adcff865f;hpb=c9384515a81cb64d345b299908b2852f51bb8e6e;p=m6w6%2Fext-psi diff --git a/src/types/impl_type.c b/src/types/impl_type.c index 25b1f1f..e4ace47 100644 --- a/src/types/impl_type.c +++ b/src/types/impl_type.c @@ -23,22 +23,26 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#include "php_psi_stdinc.h" +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# include "php_config.h" +#endif #include "data.h" -struct psi_impl_type *psi_impl_type_init(token_t type, const char *name) +struct psi_impl_type *psi_impl_type_init(token_t type, zend_string *name) { - struct psi_impl_type *t = calloc(1, sizeof(*t)); + struct psi_impl_type *t = pecalloc(1, sizeof(*t), 1); t->type = type; - t->name = strdup(name); + t->name = zend_string_copy(name); return t; } -void psi_impl_type_dump(int fd, struct psi_impl_type *type) +void psi_impl_type_dump(struct psi_dump *dump, struct psi_impl_type *type) { - dprintf(fd, "%s", type->name); + PSI_DUMP(dump, "%s", type->name->val); } void psi_impl_type_free(struct psi_impl_type **type_ptr) @@ -47,10 +51,8 @@ void psi_impl_type_free(struct psi_impl_type **type_ptr) struct psi_impl_type *type = *type_ptr; *type_ptr = NULL; - if (type->token) { - free(type->token); - } - free(type->name); + psi_token_free(&type->token); + zend_string_release(type->name); free(type); } }