return 0;
}
- if (!validate_decl_arg(data, func)) {
- return 0;
- }
for (redir = &psi_func_redirs[0]; redir->name; ++redir) {
if (!strcmp(func->var->name, redir->name)) {
decl->call.sym = redir->func;
}
return 1;
}
-
-static inline int validate_decl(PSI_Data *data, void *dl, decl *decl) {
+static inline int validate_decl_nodl(PSI_Data *data, decl *decl) {
if (!validate_decl_abi(data, decl->abi)) {
data->error(data, decl->abi->token, PSI_WARNING,
"Invalid calling convention: '%s'", decl->abi->token->text);
return 0;
}
- if (!validate_decl_func(data, dl, decl, decl->func)) {
+ if (!validate_decl_arg(data, decl->func)) {
return 0;
}
if (decl->args) {
}
return 1;
}
+static inline int validate_decl(PSI_Data *data, void *dl, decl *decl) {
+ if (!validate_decl_nodl(data, decl)) {
+ return 0;
+ }
+ if (!validate_decl_func(data, dl, decl, decl->func)) {
+ return 0;
+ }
+ return 1;
+}
static inline decl_arg *locate_decl_var_arg(decl_var *var, decl_args *args, decl_arg *func) {
size_t i;
}
}
- if (!validate_decl(data, NULL, cb_func)) {
+ if (!validate_decl_nodl(data, cb_func)) {
return 0;
}
Z_PARAM_FUNC_EX(fci, fcc, 1, 0);
if (fci.size) {
- iarg->val.zend.cb = calloc(1, sizeof(zend_fcall));
+ iarg->val.zend.cb = ecalloc(1, sizeof(zend_fcall));
iarg->val.zend.cb->fci = fci;
iarg->val.zend.cb->fcc = fcc;
}
zend_string_release(iarg->val.zend.str);
}
break;
+ case PSI_T_CALLABLE:
+ if (iarg->val.zend.cb) {
+ if (iarg->val.zend.cb->fci.size) {
+ zend_fcall_info_args_clear(&iarg->val.zend.cb->fci, 1);
+ }
+ efree(iarg->val.zend.cb);
+ }
+ break;
}
}
if (result != _result) {
*(void **)_result = result;
}
+
+ zend_fcall_info_args_clear(&iarg->val.zend.cb->fci, 0);
+ for (i = 0; i < cb->args->count; ++i) {
+ zval_ptr_dtor(&zargv[i]);
+ }
+ free(zargv);
}
static inline ffi_type *psi_ffi_decl_arg_type(decl_arg *darg);
PSI_LibffiCallFree(decl->call.info);
}
}
+
+ }
+ if (C->impls) {
+ size_t i, j;
+
+ for (i = 0; i < C->impls->count; ++i) {
+ impl *impl = C->impls->list[i];
+
+ for (j = 0; j < impl->stmts->let.count; ++j) {
+ let_stmt *let = impl->stmts->let.list[j];
+
+ if (let->val && let->val->kind == PSI_LET_CALLBACK) {
+ let_callback *cb = let->val->data.callback;
+
+ if (cb->decl && cb->decl->call.info) {
+ PSI_LibffiCallFree(cb->decl->call.info);
+ }
+ }
+ }
+ }
}
free(C->context);
}