* Contains variable linking and pointer type-checking code.
************************************************************************/
+#include <string.h>
+#include <stdlib.h>
+
+#include "Python.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-#include "Python.h"
/* Definitions for Windows/Unix exporting */
#if defined(_WIN32) || defined(__WIN32__)
if (*c != '_') {
*ptr = (void *) 0;
if (strcmp(c,"NULL") == 0) return (char *) 0;
- else c;
+ else return c;
}
c++;
/* Extract hex value from pointer */
- while (d = *c) {
+ while ((d = *c) != 0) {
if ((d >= '0') && (d <= '9'))
p = (p << 4) + (d - '0');
else if ((d >= 'a') && (d <= 'f'))
sp = &SwigPtrTable[start];
/* Try to find a match */
- while (start <= end) {
+ while (start < end) { /* was "<=" --robin */
if (strncmp(t,sp->name,sp->len) == 0) {
name = sp->name;
len = sp->len;
if (!PyString_Check(obj)) {
if (!PyInstance_Check(obj) || !(sobj = PyObject_GetAttrString(obj,"this")))
return "";
+ // PyObject_GetAttrString increases sobj refcout !
+ Py_DECREF(sobj);
}
str = PyString_AsString(sobj);
return SWIG_GetPtr(str,ptr,type);
}
+
#ifdef __cplusplus
}
#endif
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+