Refactor SWIG_SetZval to simplify the arguments. Solve constructor rename bug

- Refactor SWIG_SetZval.
- Fix the Renamed constructor - turn into static factory method bug.

Conflicts:
	Source/Modules/php.cxx
This commit is contained in:
Nihal 2017-08-28 03:46:16 +05:30
commit 9c40bbdb85
4 changed files with 48 additions and 38 deletions

View file

@ -396,12 +396,12 @@
SWIGTYPE &,
SWIGTYPE &&
%{
SWIG_SetZval($result, $classZv, $owner, $newobj, $c_obj, (void *)result, $1_descriptor, $zend_obj);
SWIG_SetZval($result, $needNewFlow, $owner, (void *)result, $1_descriptor, $zend_obj);
%}
%typemap(out) SWIGTYPE *const&
%{
SWIG_SetZval(return_value, $classZv, $owner, $newobj, $c_obj, (void *)*$1, $*1_descriptor, $zend_obj);
SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)*$1, $*1_descriptor, $zend_obj);
%}
%typemap(directorin) SWIGTYPE *,
@ -436,13 +436,13 @@
#ifdef __cplusplus
{
$&1_ltype resultobj = new $1_ltype((const $1_ltype &) $1);
SWIG_SetZval(return_value, $classZv, $owner, $newobj, $c_obj, (void *)resultobj, $&1_descriptor, $zend_obj);
SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)resultobj, $&1_descriptor, $zend_obj);
}
#else
{
$&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type));
memcpy(resultobj, &$1, sizeof($1_type));
SWIG_SetZval(return_value, $classZv, $owner, $newobj, $c_obj, (void *)resultobj, $&1_descriptor, $zend_obj);
SWIG_SetZval(return_value, $needNewFlow, $owner, (void *)resultobj, $&1_descriptor, $zend_obj);
}
#endif