Fix indentation. Use %{ %} in a couple of typemaps to avoid adding needless

{ } to the generated code.  Use memcpy() instead of memmove() where the
destination is freshly allocated so there's no possibility of overlap.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10887 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2008-10-01 11:54:31 +00:00
commit fccd1e294a

View file

@ -205,15 +205,15 @@
%typemap(out) SWIGTYPE *, %typemap(out) SWIGTYPE *,
SWIGTYPE [], SWIGTYPE [],
SWIGTYPE & SWIGTYPE &
{ %{
SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner); SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor, $owner);
} %}
%typemap(out) SWIGTYPE *DYNAMIC, %typemap(out) SWIGTYPE *DYNAMIC,
SWIGTYPE &DYNAMIC SWIGTYPE &DYNAMIC
{ {
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1); swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor, (void **) &$1);
SWIG_SetPointerZval(return_value, (void *)$1, ty, $owner); SWIG_SetPointerZval(return_value, (void *)$1, ty, $owner);
} }
%typemap(out) SWIGTYPE %typemap(out) SWIGTYPE
@ -225,7 +225,7 @@
#else #else
{ {
$&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type)); $&1_ltype resultobj = ($&1_ltype) emalloc(sizeof($1_type));
memmove(resultobj, &$1, sizeof($1_type)); memcpy(resultobj, &$1, sizeof($1_type));
SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1); SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor, 1);
} }
#endif #endif
@ -233,9 +233,9 @@
%typemap(out) void ""; %typemap(out) void "";
%typemap(out) char [ANY] %typemap(out) char [ANY]
{ %{
RETVAL_STRINGL($1,$1_dim0,1); RETVAL_STRINGL($1,$1_dim0,1);
} %}
// This typecheck does hard checking for proper argument type. If you want // This typecheck does hard checking for proper argument type. If you want
// an argument to be converted from a different PHP type, you must convert // an argument to be converted from a different PHP type, you must convert