X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Ftypes%2Fconst_type.c;h=33c1233b1a14cd03103d0814ac9d4585134d2ede;hp=46b519904ab69718b1fa4d00719056a98c0278c1;hb=b029005e56a8913fbb3d17ab497b4a37a00a211c;hpb=2f5af21b263403997e154658635d6b6e6eaab453 diff --git a/src/types/const_type.c b/src/types/const_type.c index 46b5199..33c1233 100644 --- a/src/types/const_type.c +++ b/src/types/const_type.c @@ -5,11 +5,11 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE @@ -21,32 +21,33 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 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_const_type *psi_const_type_init(token_t type, const char *name) +{ + struct psi_const_type *ct = calloc(1, sizeof(*ct)); -#include "const_type.h" - -const_type *init_const_type(token_t type, const char *name) { - const_type *ct = calloc(1, sizeof(*ct)); ct->type = type; ct->name = strdup(name); + return ct; } -void free_const_type(const_type *type) { - free(type->name); - free(type); +void psi_const_type_free(struct psi_const_type **type_ptr) +{ + if (*type_ptr) { + struct psi_const_type *type = *type_ptr; + + *type_ptr = NULL; + free(type->name); + free(type); + } } -void dump_const_type(int fd, const_type *type) { +void psi_const_type_dump(int fd, struct psi_const_type *type) +{ dprintf(fd, "%s", type->name); }