Wed, 31 Dec 2014 06:55:46 +0100
Added tag TORBROWSER_REPLICA for changeset 6474c204b198
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
michael@0 | 3 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | /* |
michael@0 | 6 | * Helper header to declare all the supported malloc functions. |
michael@0 | 7 | * MALLOC_DECL arguments are: |
michael@0 | 8 | * - function name |
michael@0 | 9 | * - return type |
michael@0 | 10 | * - argument types |
michael@0 | 11 | */ |
michael@0 | 12 | |
michael@0 | 13 | #ifndef malloc_decls_h |
michael@0 | 14 | # define malloc_decls_h |
michael@0 | 15 | |
michael@0 | 16 | # include "jemalloc_types.h" |
michael@0 | 17 | |
michael@0 | 18 | # if defined(__linux__) && (!defined(MOZ_MEMORY_ANDROID) || ANDROID_VERSION < 19) |
michael@0 | 19 | typedef void * usable_ptr_t; |
michael@0 | 20 | # else |
michael@0 | 21 | typedef const void * usable_ptr_t; |
michael@0 | 22 | # endif |
michael@0 | 23 | |
michael@0 | 24 | # define MALLOC_FUNCS_MALLOC 1 |
michael@0 | 25 | # define MALLOC_FUNCS_JEMALLOC 2 |
michael@0 | 26 | # define MALLOC_FUNCS_INIT 4 |
michael@0 | 27 | # define MALLOC_FUNCS_ALL (MALLOC_FUNCS_INIT | MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC) |
michael@0 | 28 | |
michael@0 | 29 | #endif /* malloc_decls_h */ |
michael@0 | 30 | |
michael@0 | 31 | #ifndef MALLOC_FUNCS |
michael@0 | 32 | # define MALLOC_FUNCS (MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC) |
michael@0 | 33 | #endif |
michael@0 | 34 | |
michael@0 | 35 | #ifdef MALLOC_DECL |
michael@0 | 36 | # if MALLOC_FUNCS & MALLOC_FUNCS_INIT |
michael@0 | 37 | MALLOC_DECL(init, void, const malloc_table_t *) |
michael@0 | 38 | # endif |
michael@0 | 39 | # if MALLOC_FUNCS & MALLOC_FUNCS_MALLOC |
michael@0 | 40 | MALLOC_DECL(malloc, void *, size_t) |
michael@0 | 41 | MALLOC_DECL(posix_memalign, int, void **, size_t, size_t) |
michael@0 | 42 | MALLOC_DECL(aligned_alloc, void *, size_t, size_t) |
michael@0 | 43 | MALLOC_DECL(calloc, void *, size_t, size_t) |
michael@0 | 44 | MALLOC_DECL(realloc, void *, void *, size_t) |
michael@0 | 45 | MALLOC_DECL(free, void, void *) |
michael@0 | 46 | MALLOC_DECL(memalign, void *, size_t, size_t) |
michael@0 | 47 | MALLOC_DECL(valloc, void *, size_t) |
michael@0 | 48 | MALLOC_DECL(malloc_usable_size, size_t, usable_ptr_t) |
michael@0 | 49 | MALLOC_DECL(malloc_good_size, size_t, size_t) |
michael@0 | 50 | # endif |
michael@0 | 51 | # if MALLOC_FUNCS & MALLOC_FUNCS_JEMALLOC |
michael@0 | 52 | MALLOC_DECL(jemalloc_stats, void, jemalloc_stats_t *) |
michael@0 | 53 | MALLOC_DECL(jemalloc_purge_freed_pages, void, void) |
michael@0 | 54 | MALLOC_DECL(jemalloc_free_dirty_pages, void, void) |
michael@0 | 55 | # endif |
michael@0 | 56 | #endif /* MALLOC_DECL */ |
michael@0 | 57 | |
michael@0 | 58 | #undef MALLOC_DECL |
michael@0 | 59 | #undef MALLOC_FUNCS |