summaryrefslogtreecommitdiff
path: root/cppu
diff options
context:
space:
mode:
Diffstat (limited to 'cppu')
-rw-r--r--cppu/source/threadpool/current.cxx88
1 files changed, 37 insertions, 51 deletions
diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx
index ed8891fabf8f..cd769c046d3f 100644
--- a/cppu/source/threadpool/current.cxx
+++ b/cppu/source/threadpool/current.cxx
@@ -42,57 +42,43 @@ namespace cppu
static typelib_InterfaceTypeDescription * get_type_XCurrentContext()
{
- static typelib_InterfaceTypeDescription * s_type_XCurrentContext = nullptr;
- if (nullptr == s_type_XCurrentContext)
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if (nullptr == s_type_XCurrentContext)
- {
- OUString sTypeName("com.sun.star.uno.XCurrentContext");
- typelib_InterfaceTypeDescription * pTD = nullptr;
- typelib_TypeDescriptionReference * pMembers[1] = { nullptr };
- OUString sMethodName0("com.sun.star.uno.XCurrentContext::getValueByName");
- typelib_typedescriptionreference_new(
- &pMembers[0],
- typelib_TypeClass_INTERFACE_METHOD,
- sMethodName0.pData );
- typelib_typedescription_newInterface(
- &pTD,
- sTypeName.pData, 0, 0, 0, 0, 0,
- * typelib_static_type_getByTypeClass( typelib_TypeClass_INTERFACE ),
- 1,
- pMembers );
-
- typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pTD) );
- typelib_typedescriptionreference_release( pMembers[0] );
-
- typelib_InterfaceMethodTypeDescription * pMethod = nullptr;
- typelib_Parameter_Init aParameters[1];
- OUString sParamName0("Name");
- OUString sParamType0("string");
- aParameters[0].pParamName = sParamName0.pData;
- aParameters[0].eTypeClass = typelib_TypeClass_STRING;
- aParameters[0].pTypeName = sParamType0.pData;
- aParameters[0].bIn = true;
- aParameters[0].bOut = false;
- rtl_uString * pExceptions[1];
- OUString sExceptionName0("com.sun.star.uno.RuntimeException");
- pExceptions[0] = sExceptionName0.pData;
- OUString sReturnType0("any");
- typelib_typedescription_newInterfaceMethod(
- &pMethod,
- 3, false,
- sMethodName0.pData,
- typelib_TypeClass_ANY, sReturnType0.pData,
- 1, aParameters, 1, pExceptions );
- typelib_typedescription_register( reinterpret_cast<typelib_TypeDescription**>(&pMethod) );
- typelib_typedescription_release( &pMethod->aBase.aBase );
- // another static ref:
- ++reinterpret_cast< typelib_TypeDescription * >( pTD )->
- nStaticRefCount;
- s_type_XCurrentContext = pTD;
- }
- }
+ static typelib_InterfaceTypeDescription* s_type_XCurrentContext = []() {
+ OUString sTypeName("com.sun.star.uno.XCurrentContext");
+ typelib_InterfaceTypeDescription* pTD = nullptr;
+ typelib_TypeDescriptionReference* pMembers[1] = { nullptr };
+ OUString sMethodName0("com.sun.star.uno.XCurrentContext::getValueByName");
+ typelib_typedescriptionreference_new(&pMembers[0], typelib_TypeClass_INTERFACE_METHOD,
+ sMethodName0.pData);
+ typelib_typedescription_newInterface(
+ &pTD, sTypeName.pData, 0, 0, 0, 0, 0,
+ *typelib_static_type_getByTypeClass(typelib_TypeClass_INTERFACE), 1, pMembers);
+
+ typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pTD));
+ typelib_typedescriptionreference_release(pMembers[0]);
+
+ typelib_InterfaceMethodTypeDescription* pMethod = nullptr;
+ typelib_Parameter_Init aParameters[1];
+ OUString sParamName0("Name");
+ OUString sParamType0("string");
+ aParameters[0].pParamName = sParamName0.pData;
+ aParameters[0].eTypeClass = typelib_TypeClass_STRING;
+ aParameters[0].pTypeName = sParamType0.pData;
+ aParameters[0].bIn = true;
+ aParameters[0].bOut = false;
+ rtl_uString* pExceptions[1];
+ OUString sExceptionName0("com.sun.star.uno.RuntimeException");
+ pExceptions[0] = sExceptionName0.pData;
+ OUString sReturnType0("any");
+ typelib_typedescription_newInterfaceMethod(&pMethod, 3, false, sMethodName0.pData,
+ typelib_TypeClass_ANY, sReturnType0.pData, 1,
+ aParameters, 1, pExceptions);
+ typelib_typedescription_register(reinterpret_cast<typelib_TypeDescription**>(&pMethod));
+ typelib_typedescription_release(&pMethod->aBase.aBase);
+ // another static ref:
+ ++reinterpret_cast<typelib_TypeDescription*>(pTD)->nStaticRefCount;
+ return pTD;
+ }();
+
return s_type_XCurrentContext;
}