avoid to write the pointer on failure

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7813 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-05 15:45:28 +00:00
commit 02b14340c0

View file

@ -15,15 +15,17 @@
swig::PyObject_var second = PySequence_GetItem(obj,1);
T *pfirst = 0;
U *psecond = 0;
value_type *vp = 0;
if (val) {
*val = %new_instance(std::pair<T,U>);
pfirst = &((*val)->first);
psecond = &((*val)->second);
vp = %new_instance(std::pair<T,U>);
pfirst = &(vp->first);
psecond = &(vp->second);
}
if ((swig::asval(first,pfirst) == SWIG_OK) && (swig::asval(second,psecond) == SWIG_OK)) {
if (val) *val = vp;
return SWIG_NEWOBJ;
} else {
%delete(*val);
%delete(vp);
}
} else {
value_type *p;