more fixes for valgrind

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7722 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-10-25 15:15:42 +00:00
commit ead70adb56
3 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,7 @@
use enum_thorough; use enum_thorough;
$enum_thorough::myColour;
# Just test an in and out typemap for enum SWIGTYPE and const enum SWIGTYPE & typemaps # Just test an in and out typemap for enum SWIGTYPE and const enum SWIGTYPE & typemaps
if (enum_thorough::speedTest4($enum_thorough::SpeedClass::slow) != $enum_thorough::SpeedClass::slow) { if (enum_thorough::speedTest4($enum_thorough::SpeedClass::slow) != $enum_thorough::SpeedClass::slow) {

View file

@ -156,8 +156,10 @@ SWIG_Perl_ConvertPtr(SWIG_MAYBE_PERL_OBJECT SV *sv, void **ptr, swig_type_info *
To set ownership (see bellow), an newSViv(1) entry is added. To set ownership (see bellow), an newSViv(1) entry is added.
Hence, to remove ownership, we delete the entry. Hence, to remove ownership, we delete the entry.
*/ */
SV *v = hv_delete_ent(hv, obj, 0, 0);
if (v) SvREFCNT_dec(v); /* SV *val = */
hv_delete_ent(hv, obj, 0, 0);
/* if (val) SvREFCNT_dec(val); */
} }
} }
return SWIG_OK; return SWIG_OK;

View file

@ -66,13 +66,13 @@
%set_output(obj) %enddef %set_output(obj) %enddef
/* variable output */ /* variable output */
%define %set_varoutput(obj) sv_setsv($result,obj); SvREFCNT_dec(obj) %enddef %define %set_varoutput(obj) sv_setsv($result,obj) %enddef
/* constant */ /* constant */
%define %set_constant(name, obj) %begin_block %define %set_constant(name, obj) %begin_block
SV *_obj = obj;
SV *sv = get_sv((char*) SWIG_prefix name, TRUE | 0x2); SV *sv = get_sv((char*) SWIG_prefix name, TRUE | 0x2);
sv_setsv(sv, obj); sv_setsv(sv, _obj);
SvREFCNT_dec(obj);
SvREADONLY_on(sv); SvREADONLY_on(sv);
%end_block %enddef %end_block %enddef