raising the head after a three-weeks refactoring
[m6w6/ext-psi] / src / types / const_type.c
index 46b519904ab69718b1fa4d00719056a98c0278c1..33c1233b1a14cd03103d0814ac9d4585134d2ede 100644 (file)
@@ -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
  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 <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+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);
 }