mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-25 15:18:11 +00:00
feat(c-wrapper): little optimization on getCBackPtr
This commit is contained in:
parent
5e80df36fa
commit
e783a88a31
1 changed files with 8 additions and 3 deletions
|
|
@ -244,7 +244,8 @@ public:
|
|||
static inline typename CppTypeMetaInfo<CppType>::cType *getCBackPtr (const std::shared_ptr<CppType> &cppObject) {
|
||||
typedef typename CppTypeMetaInfo<CppType>::cType RetType;
|
||||
|
||||
if (!cppObject) return nullptr;
|
||||
if (L_UNLIKELY(!cppObject))
|
||||
return nullptr;
|
||||
|
||||
Variant variant = cppObject->getProperty("LinphonePrivate::Wrapper::cBackPtr");
|
||||
void *value = variant.getValue<void *>();
|
||||
|
|
@ -261,7 +262,9 @@ public:
|
|||
typename = typename std::enable_if<IsDefinedNotClonableCppObject<CppType>::value, CppType>::type
|
||||
>
|
||||
static inline typename CppTypeMetaInfo<CppType>::cType *getCBackPtr (CppType *cppObject) {
|
||||
if (!cppObject) return nullptr;
|
||||
if (L_UNLIKELY(!cppObject))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
return getCBackPtr(std::static_pointer_cast<CppType>(cppObject->shared_from_this()));
|
||||
} catch (const std::bad_weak_ptr &e) {
|
||||
|
|
@ -277,8 +280,10 @@ public:
|
|||
typename = typename std::enable_if<IsDefinedClonableCppObject<CppType>::value, CppType>::type
|
||||
>
|
||||
static inline typename CppTypeMetaInfo<CppType>::cType *getCBackPtr (const CppType *cppObject) {
|
||||
if (L_UNLIKELY(!cppObject))
|
||||
return nullptr;
|
||||
|
||||
typedef typename CppTypeMetaInfo<CppType>::cType RetType;
|
||||
if (!cppObject) return nullptr;
|
||||
|
||||
Variant variant = cppObject->getProperty("LinphonePrivate::Wrapper::cBackPtr");
|
||||
void *value = variant.getValue<void *>();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue