memory/build/malloc_decls.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial