Bug 1395088 - Remove the jemalloc_bool type. r=njn

Back when it was added (for Windows CE, in bug 488608), mozjemalloc was
C and all the supported compilers didn't support C99 bools. Now
mozjemalloc is C++, and all the supported compilers support C99 bools
for the cases where the type is used from C.

--HG--
extra : rebase_source : b9c710a0c48dc36cb473af59e3119131d13523ce
This commit is contained in:
Mike Hommey 2017-08-30 18:04:47 +09:00
Родитель 455e018ede
Коммит 57c65279a0
5 изменённых файлов: 7 добавлений и 10 удалений

Просмотреть файл

@ -2772,9 +2772,7 @@ void
Gecko_SetJemallocThreadLocalArena(bool enabled)
{
#if defined(MOZ_MEMORY)
// At this point we convert |enabled| from a plain C++ bool to a
// |jemalloc_bool|, so be on the safe side.
jemalloc_thread_local_arena(!!enabled);
jemalloc_thread_local_arena(enabled);
#endif
}

Просмотреть файл

@ -61,7 +61,7 @@ MALLOC_DECL(malloc_good_size, size_t, size_t)
MALLOC_DECL_VOID(jemalloc_stats, jemalloc_stats_t *)
MALLOC_DECL_VOID(jemalloc_purge_freed_pages)
MALLOC_DECL_VOID(jemalloc_free_dirty_pages)
MALLOC_DECL_VOID(jemalloc_thread_local_arena, jemalloc_bool)
MALLOC_DECL_VOID(jemalloc_thread_local_arena, bool)
# endif
# undef MALLOC_DECL_VOID

Просмотреть файл

@ -85,6 +85,6 @@ MOZ_JEMALLOC_API void jemalloc_purge_freed_pages();
*/
MOZ_JEMALLOC_API void jemalloc_free_dirty_pages();
MOZ_JEMALLOC_API void jemalloc_thread_local_arena(jemalloc_bool enabled);
MOZ_JEMALLOC_API void jemalloc_thread_local_arena(bool enabled);
#endif /* mozmemory_h */

Просмотреть файл

@ -38,13 +38,12 @@
#else
#include <stddef.h>
#endif
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned char jemalloc_bool;
/*
* jemalloc_stats() is not a stable interface. When using jemalloc_stats_t, be
* sure that the compiled results of jemalloc.c are in sync with this header
@ -54,8 +53,8 @@ typedef struct {
/*
* Run-time configuration settings.
*/
jemalloc_bool opt_junk; /* Fill allocated memory with kAllocJunk? */
jemalloc_bool opt_zero; /* Fill allocated memory with 0x0? */
bool opt_junk; /* Fill allocated memory with kAllocJunk? */
bool opt_zero; /* Fill allocated memory with 0x0? */
size_t narenas; /* Number of arenas. */
size_t quantum; /* Allocation quantum. */
size_t small_max; /* Max quantum-spaced allocation size. */

Просмотреть файл

@ -253,7 +253,7 @@ replace_jemalloc_free_dirty_pages(void)
}
void
replace_jemalloc_thread_local_arena(jemalloc_bool aEnabled)
replace_jemalloc_thread_local_arena(bool aEnabled)
{
gFuncs->jemalloc_thread_local_arena(aEnabled);
const malloc_hook_table_t* hook_table = gHookTable;