update readme
[m6w6/ext-psi] / src / types / free_exp.c
index 115da914a181c39a0a4a28e2c16e0fab29172b1d..b522de5bd41db7d778ac1db0e79475c177689f54 100644 (file)
  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"
 #include "call.h"
 
 struct psi_free_exp *psi_free_exp_init(zend_string *func, struct psi_plist *vars)
 {
-       struct psi_free_exp *f = calloc(1, sizeof(*f));
+       struct psi_free_exp *f = pecalloc(1, sizeof(*f), 1);
        f->func = zend_string_copy(func);
        f->vars = vars;
        return f;
@@ -51,19 +55,19 @@ void psi_free_exp_free(struct psi_free_exp **f_ptr)
        }
 }
 
-void psi_free_exp_dump(int fd, struct psi_free_exp *call)
+void psi_free_exp_dump(struct psi_dump *dump, struct psi_free_exp *call)
 {
        size_t l = 0, c = psi_plist_count(call->vars);
        struct psi_decl_var *fvar;
 
-       dprintf(fd, "%s(", call->func->val);
+       PSI_DUMP(dump, "%s(", call->func->val);
        while (psi_plist_get(call->vars, l++, &fvar)) {
-               psi_decl_var_dump(fd, fvar);
+               psi_decl_var_dump(dump, fvar);
                if (l < c) {
-                       dprintf(fd, ", ");
+                       PSI_DUMP(dump, ", ");
                }
        }
-       dprintf(fd, ")");
+       PSI_DUMP(dump, ")");
 }
 
 static inline struct psi_decl *locate_free_decl(struct psi_plist *decls,
@@ -99,7 +103,7 @@ bool psi_free_exp_validate(struct psi_data *data, struct psi_free_exp *exp,
        }
 
        /* now check for known vars */
-       exp->let = calloc(psi_plist_count(exp->vars), sizeof(*exp->let));
+       exp->let = pecalloc(psi_plist_count(exp->vars), sizeof(*exp->let), 1);
        for (i = 0; psi_plist_get(exp->vars, i, &free_var); ++i) {
                if (!psi_impl_get_decl_arg(scope->impl, free_var)) {
                        data->error(data, free_var->token, PSI_WARNING,