summaryrefslogtreecommitdiffstats
path: root/libshiboken/basewrapper.cpp
diff options
context:
space:
mode:
authorHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 13:48:01 -0200
committerHugo Parente Lima <hugo.pl@gmail.com>2010-11-10 15:36:29 -0200
commit0316703e8960c6b548e38ad243bdb4fd155b2460 (patch)
treeb46611f549552f1284f12fa169b8ee2a451484c1 /libshiboken/basewrapper.cpp
parent9016e6ef09c19406d2e57066966eae4d54010728 (diff)
downloadshiboken-0316703e8960c6b548e38ad243bdb4fd155b2460.tar.gz
shiboken-0316703e8960c6b548e38ad243bdb4fd155b2460.tar.xz
shiboken-0316703e8960c6b548e38ad243bdb4fd155b2460.zip
SbkBaseWrapper_TpNew renamed to SbkObjectTpNew, now using C linkage and moved outside C++ namespace.
Diffstat (limited to 'libshiboken/basewrapper.cpp')
-rw-r--r--libshiboken/basewrapper.cpp41
1 files changed, 21 insertions, 20 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 5de9024e..3337a4d2 100644
--- a/libshiboken/basewrapper.cpp
+++ b/libshiboken/basewrapper.cpp
@@ -247,6 +247,26 @@ PyObject* SbkBaseWrapperType_TpNew(PyTypeObject* metatype, PyObject* args, PyObj
return reinterpret_cast<PyObject*>(newType);
}
+PyObject* SbkObjectTpNew(PyTypeObject* subtype, PyObject*, PyObject*)
+{
+ SbkObject* self = reinterpret_cast<SbkObject*>(subtype->tp_alloc(subtype, 0));
+ self->d = new SbkBaseWrapperPrivate;
+
+ SbkBaseWrapperType* sbkType = reinterpret_cast<SbkBaseWrapperType*>(subtype);
+ int numBases = sbkType->is_multicpp ? Shiboken::getNumberOfCppBaseClasses(subtype) : 1;
+ self->d->cptr = new void*[numBases];
+ std::memset(self->d->cptr, 0, sizeof(void*)*numBases);
+ self->d->hasOwnership = 1;
+ self->d->containsCppWrapper = 0;
+ self->d->validCppObject = 0;
+ self->d->parentInfo = 0;
+ self->ob_dict = 0;
+ self->weakreflist = 0;
+ self->d->referredObjects = 0;
+ return reinterpret_cast<PyObject*>(self);
+}
+
+
} //extern "C"
namespace Shiboken
@@ -381,25 +401,6 @@ void walkThroughClassHierarchy(PyTypeObject* currentType, HierarchyVisitor* visi
}
}
-PyObject* SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*)
-{
- SbkObject* self = reinterpret_cast<SbkObject*>(subtype->tp_alloc(subtype, 0));
- self->d = new SbkBaseWrapperPrivate;
-
- SbkBaseWrapperType* sbkType = reinterpret_cast<SbkBaseWrapperType*>(subtype);
- int numBases = sbkType->is_multicpp ? getNumberOfCppBaseClasses(subtype) : 1;
- self->d->cptr = new void*[numBases];
- std::memset(self->d->cptr, 0, sizeof(void*)*numBases);
- self->d->hasOwnership = 1;
- self->d->containsCppWrapper = 0;
- self->d->validCppObject = 0;
- self->d->parentInfo = 0;
- self->ob_dict = 0;
- self->weakreflist = 0;
- self->d->referredObjects = 0;
- return reinterpret_cast<PyObject*>(self);
-}
-
void setTypeUserData(SbkObject* wrapper, void *user_data, DeleteUserDataFunc d_func)
{
SbkBaseWrapperType* ob_type = reinterpret_cast<SbkBaseWrapperType*>(wrapper->ob_type);
@@ -714,7 +715,7 @@ PyObject* newObject(SbkBaseWrapperType* instanceType,
instanceType = BindingManager::instance().resolveType(cptr, instanceType);
}
- SbkObject* self = reinterpret_cast<SbkObject*>(SbkBaseWrapper_TpNew(reinterpret_cast<PyTypeObject*>(instanceType), 0, 0));
+ SbkObject* self = reinterpret_cast<SbkObject*>(SbkObjectTpNew(reinterpret_cast<PyTypeObject*>(instanceType), 0, 0));
self->d->cptr[0] = cptr;
self->d->hasOwnership = hasOwnership;
self->d->validCppObject = 1;