diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-08-01 20:39:18 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-08-02 08:19:49 +0200 |
commit | e3c0b6e6eecdcd94b37d8bb126668ec0db52d487 (patch) | |
tree | 96f613e68cb0bef1e785bc8722d0b1ef19df9850 /sal | |
parent | df6270e9c1d75a4865bf79043190669b74de71d3 (diff) |
Revert rtl_alloc_preInit back to boolean argument
This effectively reverts 271a663d2f098f3f665cab6da2e13b265a7eab93 "rtl: support
start/stop threads around pre-init" again, now that
df6ba650469a6f2fda06ef1c2e107ccdd3570505 "Remove 'officially dead now' rtl_cache
slab allocator mechanism" removed the wsupdate thread.
(rtl_alloc_preInit is an internal-use-only C function, so changing its arguments
doesn't affect URE compatibility.)
Change-Id: Ie9bce86377f9520e2600e4111ac525dddace10f8
Reviewed-on: https://gerrit.libreoffice.org/58443
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/qa/rtl/alloc/rtl_alloc.cxx | 4 | ||||
-rw-r--r-- | sal/rtl/strimp.cxx | 46 |
2 files changed, 20 insertions, 30 deletions
diff --git a/sal/qa/rtl/alloc/rtl_alloc.cxx b/sal/qa/rtl/alloc/rtl_alloc.cxx index 37c7b41eb338..0e9b7c0f47a8 100644 --- a/sal/qa/rtl/alloc/rtl_alloc.cxx +++ b/sal/qa/rtl/alloc/rtl_alloc.cxx @@ -158,7 +158,7 @@ public: const char *sample = "Hello World"; std::vector<OUString> aStrings; - rtl_alloc_preInit(rtlAllocPreInitStart); + rtl_alloc_preInit(true); OUString aFoo("foo"); @@ -183,7 +183,7 @@ public: } // should static-ize all the strings. - rtl_alloc_preInit(rtlAllocPreInitEnd); + rtl_alloc_preInit(false); for (size_t i = 0; i < aStrings.size(); ++i) CPPUNIT_ASSERT_MESSAGE( "static after.", (aStrings[i].pData->refCount & SAL_STRING_STATIC_FLAG) ); diff --git a/sal/rtl/strimp.cxx b/sal/rtl/strimp.cxx index e356a4e921a6..d1651a2ad1d7 100644 --- a/sal/rtl/strimp.cxx +++ b/sal/rtl/strimp.cxx @@ -94,36 +94,26 @@ static void mark_static(void *addr, sal_Size /* size */) str->refCount |= SAL_STRING_STATIC_FLAG; } -void SAL_CALL rtl_alloc_preInit (rtl_alloc_preInit_phase_t phase) SAL_THROW_EXTERN_C() +void SAL_CALL rtl_alloc_preInit (sal_Bool start) SAL_THROW_EXTERN_C() { - switch (phase) + if (start) { - case rtlAllocPreInitStart: - { - rtl_allocateString = pre_allocateStringFn; - rtl_freeString = pre_freeStringFn; - pre_arena = rtl_arena_create("pre-init strings", 4, 0, - nullptr, rtl_arena_alloc, - rtl_arena_free, 0); - - // To be consistent (and to ensure the rtl_cache threads are started). - ensureCacheSingleton(); - } - break; - - case rtlAllocPreInitEnd: - // back to normal - { - rtl_arena_foreach(pre_arena, mark_static); - rtl_allocateString = rtl_allocateMemory; - rtl_freeString = rtl_freeMemory; - - // TODO: also re-initialize main allocator as well. - } - break; - - case rtlAllocPostInit: // no longer used - break; + rtl_allocateString = pre_allocateStringFn; + rtl_freeString = pre_freeStringFn; + pre_arena = rtl_arena_create("pre-init strings", 4, 0, + nullptr, rtl_arena_alloc, + rtl_arena_free, 0); + + // To be consistent (and to ensure the rtl_cache threads are started). + ensureCacheSingleton(); + } + else + { + rtl_arena_foreach(pre_arena, mark_static); + rtl_allocateString = rtl_allocateMemory; + rtl_freeString = rtl_freeMemory; + + // TODO: also re-initialize main allocator as well. } } |