aboutsummaryrefslogtreecommitdiffstats
path: root/libshiboken
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>2012-03-08 16:08:57 -0300
commit4d0bbcf41feb5a1e2a1e7adc52f40ad0f187d6ea (patch)
treee7180cda0e0c2326e09b81c41e4aee4d8aaca410 /libshiboken
parent4c0e03c6fefefd75c270b2b47eb0d240301ade0e (diff)
SbkBaseWrapper_TpNew renamed to SbkObjectTpNew, now using C linkage and moved outside C++ namespace.
Diffstat (limited to 'libshiboken')
-rw-r--r--libshiboken/basewrapper.cpp41
-rw-r--r--libshiboken/basewrapper.h5
2 files changed, 23 insertions, 23 deletions
diff --git a/libshiboken/basewrapper.cpp b/libshiboken/basewrapper.cpp
index 5de9024e5..3337a4d25 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;
diff --git a/libshiboken/basewrapper.h b/libshiboken/basewrapper.h
index 9702992ab..df5f8e352 100644
--- a/libshiboken/basewrapper.h
+++ b/libshiboken/basewrapper.h
@@ -101,6 +101,8 @@ struct LIBSHIBOKEN_API SbkBaseWrapperType
DeleteUserDataFunc d_func;
};
+LIBSHIBOKEN_API PyObject* SbkObjectTpNew(PyTypeObject* subtype, PyObject*, PyObject*);
+
} // extern "C"
namespace Shiboken
@@ -167,9 +169,6 @@ LIBSHIBOKEN_API bool canCallConstructor(PyTypeObject* myType, PyTypeObject* ctor
#define SbkBaseWrapper_Check(op) PyObject_TypeCheck(op, (PyTypeObject*)&SbkBaseWrapper_Type)
#define SbkBaseWrapper_CheckExact(op) ((op)->ob_type == &SbkBaseWrapper_Type)
-LIBSHIBOKEN_API PyObject*
-SbkBaseWrapper_TpNew(PyTypeObject* subtype, PyObject*, PyObject*);
-
/**
* Increments the reference count of the referred Python object.
* A previous Python object in the same position identified by the 'key' parameter