[python] Simpler code for SWIG_AsVal_bool() which fixes a "strict
aliasing" warning from GCC - patch from SF#1724581 by Andrew Baumann. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9938 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e2d7f303b8
commit
8178898960
2 changed files with 10 additions and 12 deletions
|
|
@ -1,6 +1,11 @@
|
||||||
Version 1.3.32 (in progress)
|
Version 1.3.32 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
09/17/2007: olly
|
||||||
|
[python] Simpler code for SWIG_AsVal_bool() which fixes a "strict
|
||||||
|
aliasing" warning from GCC - patch from SF#1724581 by Andrew
|
||||||
|
Baumann.
|
||||||
|
|
||||||
09/17/2007: olly
|
09/17/2007: olly
|
||||||
[perl5] Use sv_setpvn() to set a scalar from a pointer and length
|
[perl5] Use sv_setpvn() to set a scalar from a pointer and length
|
||||||
- patch from SF#174460 by "matsubaray".
|
- patch from SF#174460 by "matsubaray".
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,11 @@ SWIGINTERNINLINE PyObject*
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SWIG_AsVal_dec(bool)(PyObject *obj, bool *val)
|
SWIG_AsVal_dec(bool)(PyObject *obj, bool *val)
|
||||||
{
|
{
|
||||||
if (obj == Py_True) {
|
int r = PyObject_IsTrue(obj);
|
||||||
if (val) *val = true;
|
if (r == -1)
|
||||||
return SWIG_OK;
|
return SWIG_ERROR;
|
||||||
} else if (obj == Py_False) {
|
if (val) *val = r ? true : false;
|
||||||
if (val) *val = false;
|
return SWIG_OK;
|
||||||
return SWIG_OK;
|
|
||||||
} else {
|
|
||||||
long v = 0;
|
|
||||||
int res = SWIG_AddCast(SWIG_AsVal(long)(obj, val ? &v : 0));
|
|
||||||
if (SWIG_IsOK(res) && val) *val = v ? true : false;
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue