Eliminate $zend_obj typemap variable
We can just get the zend_class_entry from the swig_type_info when we need it.
This commit is contained in:
parent
c4ff1ed7cb
commit
dcdaaba7ba
4 changed files with 15 additions and 24 deletions
|
|
@ -95,8 +95,7 @@ if (!dcast) {
|
|||
Type *dobj = dynamic_cast<Type *>($1);
|
||||
if (dobj) {
|
||||
dcast = 1;
|
||||
zend_object *std = $descriptor(Type)##_ce->create_object($descriptor(Type)##_ce);
|
||||
SWIG_SetZval(return_value, $needNewFlow, $owner, SWIG_as_voidptr(dobj), $descriptor(Type *), std);
|
||||
SWIG_SetZval(return_value, $needNewFlow, $owner, SWIG_as_voidptr(dobj), $descriptor(Type *));
|
||||
}
|
||||
}%enddef
|
||||
|
||||
|
|
@ -105,6 +104,6 @@ if (!dcast) {
|
|||
int dcast = 0;
|
||||
%formacro(%_factory_dispatch, Types)
|
||||
if (!dcast) {
|
||||
SWIG_SetZval(return_value, $needNewFlow, $owner, SWIG_as_voidptr($1), $descriptor, $zend_obj);
|
||||
SWIG_SetZval(return_value, $needNewFlow, $owner, SWIG_as_voidptr($1), $descriptor);
|
||||
}
|
||||
}%enddef
|
||||
|
|
|
|||
|
|
@ -371,12 +371,12 @@
|
|||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetZval($result, $needNewFlow, $owner, (void *)result, $1_descriptor, $zend_obj);
|
||||
SWIG_SetZval($result, $needNewFlow, $owner, (void *)result, $1_descriptor);
|
||||
%}
|
||||
|
||||
%typemap(out) SWIGTYPE *const&
|
||||
%{
|
||||
SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)*$1, $*1_descriptor, $zend_obj);
|
||||
SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)*$1, $*1_descriptor);
|
||||
%}
|
||||
|
||||
%typemap(directorin) SWIGTYPE *,
|
||||
|
|
@ -384,7 +384,7 @@
|
|||
SWIGTYPE &,
|
||||
SWIGTYPE &&
|
||||
%{
|
||||
SWIG_SetZval($input, $needNewFlow, $owner, (void *)&$1, $1_descriptor, $zend_obj);
|
||||
SWIG_SetZval($input, $needNewFlow, $owner, (void *)&$1, $1_descriptor);
|
||||
%}
|
||||
|
||||
%typemap(out, fragment="swig_php_init_member_ptr") SWIGTYPE (CLASS::*)
|
||||
|
|
@ -411,19 +411,19 @@
|
|||
#ifdef __cplusplus
|
||||
{
|
||||
$&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1);
|
||||
SWIG_SetZval(return_value, $needNewFlow, 1, (void *)resultobj, $&1_descriptor, $zend_obj);
|
||||
SWIG_SetZval(return_value, $needNewFlow, 1, (void *)resultobj, $&1_descriptor);
|
||||
}
|
||||
#else
|
||||
{
|
||||
$&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type));
|
||||
memcpy(resultobj, &$1, sizeof($1_type));
|
||||
SWIG_SetZval(return_value, $needNewFlow, 1, (void *)resultobj, $&1_descriptor, $zend_obj);
|
||||
SWIG_SetZval(return_value, $needNewFlow, 1, (void *)resultobj, $&1_descriptor);
|
||||
}
|
||||
#endif
|
||||
|
||||
%typemap(directorin) SWIGTYPE
|
||||
%{
|
||||
SWIG_SetZval($input, $needNewFlow, 1, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor, $zend_obj);
|
||||
SWIG_SetZval($input, $needNewFlow, 1, SWIG_as_voidptr(new $1_ltype((const $1_ltype &)$1)), $&1_descriptor);
|
||||
%}
|
||||
|
||||
%typemap(out) void "";
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
|
|||
}
|
||||
|
||||
static void
|
||||
SWIG_SetZval(zval *zv, int newFlow, int newobject, void *ptr, swig_type_info *type, zend_object *std) {
|
||||
SWIG_SetZval(zval *zv, int newFlow, int newobject, void *ptr, swig_type_info *type) {
|
||||
if (!ptr) {
|
||||
ZVAL_NULL(zv);
|
||||
return;
|
||||
|
|
@ -209,8 +209,10 @@ SWIG_SetZval(zval *zv, int newFlow, int newobject, void *ptr, swig_type_info *ty
|
|||
|
||||
if (newFlow) {
|
||||
swig_object_wrapper *obj;
|
||||
if (newFlow == 1)
|
||||
ZVAL_OBJ(zv,std);
|
||||
if (newFlow == 1) {
|
||||
zend_class_entry *ce = (zend_class_entry*)type->clientdata;
|
||||
ZVAL_OBJ(zv, ce->create_object(ce));
|
||||
}
|
||||
obj = SWIG_Z_FETCH_OBJ_P(zv);
|
||||
obj->ptr = ptr;
|
||||
obj->newobject = newobject;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue