X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fimpl_type.c;h=f865bd899dac3129cff4f50a847c9d39bab29e27;hp=a5b21889e225d2964109796dc32f84385a8b354c;hb=9bcb1df0786a8193d65949c857baaba2f4296e84;hpb=5e240548ba570610ce0dbc248a2b7654a0e080fa diff --git a/src/types/impl_type.c b/src/types/impl_type.c index a5b2188..f865bd8 100644 --- a/src/types/impl_type.c +++ b/src/types/impl_type.c @@ -23,26 +23,29 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *******************************************************************************/ -#ifdef HAVE_CONFIG_H -# include "config.h" -#else -# include "php_config.h" -#endif +#include "php_psi_stdinc.h" +#include "data.h" -#include -#include -#include +struct psi_impl_type *psi_impl_type_init(token_t type, const char *name) +{ + struct psi_impl_type *t = calloc(1, sizeof(*t)); -#include "impl_type.h" - -impl_type *init_impl_type(token_t type, const char *name) { - impl_type *t = calloc(1, sizeof(*t)); t->type = type; t->name = strdup(name); + return t; } -void free_impl_type(impl_type *type) { - free(type->name); - free(type); +void psi_impl_type_free(struct psi_impl_type **type_ptr) +{ + if (*type_ptr) { + struct psi_impl_type *type = *type_ptr; + + *type_ptr = NULL; + if (type->token) { + free(type->token); + } + free(type->name); + free(type); + } }