summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-20 15:31:56 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-05-22 17:52:25 +0000
commit602fc6153fd1d326a827351e7ade649638446f7c (patch)
tree76dae5aa7627c7d5267de71a50578a767415051d /sal
parent866d1bbecb7cfe8256d38e5fb77c7bce149e648f (diff)
Convert AllocMode to scoped enum
Change-Id: I642d7546059f1af993ab15eb3948949109df05c4 Reviewed-on: https://gerrit.libreoffice.org/25203 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/alloc_cache.cxx4
-rw-r--r--sal/rtl/alloc_global.cxx18
-rw-r--r--sal/rtl/alloc_impl.hxx2
3 files changed, 12 insertions, 12 deletions
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index 362582fe849f..b557504bb001 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -1133,7 +1133,7 @@ SAL_CALL rtl_cache_alloc (
if (cache == nullptr)
return nullptr;
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
obj = rtl_allocateMemory(cache->m_type_size);
if ((obj != nullptr) && (cache->m_constructor != nullptr))
@@ -1216,7 +1216,7 @@ SAL_CALL rtl_cache_free (
{
if ((obj != nullptr) && (cache != nullptr))
{
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
if (cache->m_destructor != nullptr)
{
diff --git a/sal/rtl/alloc_global.cxx b/sal/rtl/alloc_global.cxx
index 6c9b2888e0c4..703a42b0902a 100644
--- a/sal/rtl/alloc_global.cxx
+++ b/sal/rtl/alloc_global.cxx
@@ -29,13 +29,13 @@
#include "rtllifecycle.h"
#include <oslmemory.h>
-AllocMode alloc_mode = AMode_UNSET;
+AllocMode alloc_mode = AllocMode::UNSET;
#if !defined(FORCE_SYSALLOC)
static void determine_alloc_mode()
{
- assert(alloc_mode == AMode_UNSET);
- alloc_mode = (getenv("G_SLICE") == nullptr ? AMode_CUSTOM : AMode_SYSTEM);
+ assert(alloc_mode == AllocMode::UNSET);
+ alloc_mode = (getenv("G_SLICE") == nullptr ? AllocMode::CUSTOM : AllocMode::SYSTEM);
}
/* ================================================================= *
@@ -296,11 +296,11 @@ void* SAL_CALL rtl_allocateMemory (sal_Size n) SAL_THROW_EXTERN_C()
#if !defined(FORCE_SYSALLOC)
while (true)
{
- if (alloc_mode == AMode_CUSTOM)
+ if (alloc_mode == AllocMode::CUSTOM)
{
return rtl_allocateMemory_CUSTOM(n);
}
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
return rtl_allocateMemory_SYSTEM(n);
}
@@ -319,11 +319,11 @@ void* SAL_CALL rtl_reallocateMemory (void * p, sal_Size n) SAL_THROW_EXTERN_C()
#if !defined(FORCE_SYSALLOC)
while (true)
{
- if (alloc_mode == AMode_CUSTOM)
+ if (alloc_mode == AllocMode::CUSTOM)
{
return rtl_reallocateMemory_CUSTOM(p,n);
}
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
return rtl_reallocateMemory_SYSTEM(p,n);
}
@@ -339,12 +339,12 @@ void SAL_CALL rtl_freeMemory (void * p) SAL_THROW_EXTERN_C()
#if !defined(FORCE_SYSALLOC)
while (true)
{
- if (alloc_mode == AMode_CUSTOM)
+ if (alloc_mode == AllocMode::CUSTOM)
{
rtl_freeMemory_CUSTOM(p);
return;
}
- if (alloc_mode == AMode_SYSTEM)
+ if (alloc_mode == AllocMode::SYSTEM)
{
rtl_freeMemory_SYSTEM(p);
return;
diff --git a/sal/rtl/alloc_impl.hxx b/sal/rtl/alloc_impl.hxx
index 3666996cb8ac..d10ba930c57e 100644
--- a/sal/rtl/alloc_impl.hxx
+++ b/sal/rtl/alloc_impl.hxx
@@ -228,7 +228,7 @@ typedef CRITICAL_SECTION rtl_memory_lock_type;
#define RTL_CACHE_FLAG_NOMAGAZINE (1 << 13) /* w/o magazine layer */
#define RTL_CACHE_FLAG_QUANTUMCACHE (2 << 13) /* used as arena quantum cache */
-typedef enum { AMode_CUSTOM, AMode_SYSTEM, AMode_UNSET } AllocMode;
+enum class AllocMode { CUSTOM, SYSTEM, UNSET };
extern AllocMode alloc_mode;