[API CHANGE] Deprecate unused typelib_setCacheSize and make it a no-op
...and simplify the remaining code using the (now const) nCacheSize Change-Id: I4468cf223c158a318ba56ba63f5f60121c94f42d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134879 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
0adee3ac50
commit
c3e9eb997f
2 changed files with 7 additions and 20 deletions
|
@ -161,7 +161,7 @@ typedef std::list< CallbackEntry > CallbackSet_Impl;
|
||||||
typedef std::list< typelib_TypeDescription * > TypeDescriptionList_Impl;
|
typedef std::list< typelib_TypeDescription * > TypeDescriptionList_Impl;
|
||||||
|
|
||||||
// # of cached elements
|
// # of cached elements
|
||||||
static sal_Int32 nCacheSize = 256;
|
constexpr auto nCacheSize = 256;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ bool complete(typelib_TypeDescription ** ppTypeDescr, bool initTables) {
|
||||||
|
|
||||||
// insert into the cache
|
// insert into the cache
|
||||||
MutexGuard aGuard( rInit.maMutex );
|
MutexGuard aGuard( rInit.maMutex );
|
||||||
if( static_cast<sal_Int32>(rInit.maCache.size()) >= nCacheSize )
|
if( rInit.maCache.size() >= nCacheSize )
|
||||||
{
|
{
|
||||||
typelib_typedescription_release( rInit.maCache.front() );
|
typelib_typedescription_release( rInit.maCache.front() );
|
||||||
rInit.maCache.pop_front();
|
rInit.maCache.pop_front();
|
||||||
|
@ -2031,7 +2031,7 @@ extern "C" void SAL_CALL typelib_typedescription_getByName(
|
||||||
|
|
||||||
// insert into the cache
|
// insert into the cache
|
||||||
MutexGuard aGuard( rInit.maMutex );
|
MutexGuard aGuard( rInit.maMutex );
|
||||||
if( static_cast<sal_Int32>(rInit.maCache.size()) >= nCacheSize )
|
if( rInit.maCache.size() >= nCacheSize )
|
||||||
{
|
{
|
||||||
typelib_typedescription_release( rInit.maCache.front() );
|
typelib_typedescription_release( rInit.maCache.front() );
|
||||||
rInit.maCache.pop_front();
|
rInit.maCache.pop_front();
|
||||||
|
@ -2085,7 +2085,7 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_new(
|
||||||
|
|
||||||
// insert into the cache
|
// insert into the cache
|
||||||
MutexGuard aGuard( rInit.maMutex );
|
MutexGuard aGuard( rInit.maMutex );
|
||||||
if( static_cast<sal_Int32>(rInit.maCache.size()) >= nCacheSize )
|
if( rInit.maCache.size() >= nCacheSize )
|
||||||
{
|
{
|
||||||
typelib_typedescription_release( rInit.maCache.front() );
|
typelib_typedescription_release( rInit.maCache.front() );
|
||||||
rInit.maCache.pop_front();
|
rInit.maCache.pop_front();
|
||||||
|
@ -2288,24 +2288,9 @@ extern "C" void SAL_CALL typelib_typedescriptionreference_assign(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 nNewSize )
|
extern "C" void SAL_CALL typelib_setCacheSize( sal_Int32 )
|
||||||
SAL_THROW_EXTERN_C()
|
SAL_THROW_EXTERN_C()
|
||||||
{
|
{
|
||||||
OSL_ENSURE( nNewSize >= 0, "### illegal cache size given!" );
|
|
||||||
if (nNewSize < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
TypeDescriptor_Init_Impl &rInit = Init();
|
|
||||||
MutexGuard aGuard( rInit.maMutex );
|
|
||||||
if (nNewSize < nCacheSize)
|
|
||||||
{
|
|
||||||
while (static_cast<sal_Int32>(rInit.maCache.size()) != nNewSize)
|
|
||||||
{
|
|
||||||
typelib_typedescription_release( rInit.maCache.front() );
|
|
||||||
rInit.maCache.pop_front();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nCacheSize = nNewSize;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -720,6 +720,8 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_getByName(
|
||||||
/** Sets size of type description cache.
|
/** Sets size of type description cache.
|
||||||
|
|
||||||
@param nNewSize new size of cache
|
@param nNewSize new size of cache
|
||||||
|
|
||||||
|
@deprecated Do not use, it does not have any effect.
|
||||||
*/
|
*/
|
||||||
CPPU_DLLPUBLIC void SAL_CALL typelib_setCacheSize(
|
CPPU_DLLPUBLIC void SAL_CALL typelib_setCacheSize(
|
||||||
sal_Int32 nNewSize )
|
sal_Int32 nNewSize )
|
||||||
|
|
Loading…
Reference in a new issue