memory/build/malloc_decls.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/memory/build/malloc_decls.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +/*
     1.9 + * Helper header to declare all the supported malloc functions.
    1.10 + * MALLOC_DECL arguments are:
    1.11 + *   - function name
    1.12 + *   - return type
    1.13 + *   - argument types
    1.14 + */
    1.15 +
    1.16 +#ifndef malloc_decls_h
    1.17 +#  define malloc_decls_h
    1.18 +
    1.19 +#  include "jemalloc_types.h"
    1.20 +
    1.21 +#  if defined(__linux__) && (!defined(MOZ_MEMORY_ANDROID) || ANDROID_VERSION < 19)
    1.22 +typedef void * usable_ptr_t;
    1.23 +#  else
    1.24 +typedef const void * usable_ptr_t;
    1.25 +#  endif
    1.26 +
    1.27 +#  define MALLOC_FUNCS_MALLOC 1
    1.28 +#  define MALLOC_FUNCS_JEMALLOC 2
    1.29 +#  define MALLOC_FUNCS_INIT 4
    1.30 +#  define MALLOC_FUNCS_ALL (MALLOC_FUNCS_INIT | MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC)
    1.31 +
    1.32 +#endif /* malloc_decls_h */
    1.33 +
    1.34 +#ifndef MALLOC_FUNCS
    1.35 +#  define MALLOC_FUNCS (MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC)
    1.36 +#endif
    1.37 +
    1.38 +#ifdef MALLOC_DECL
    1.39 +#  if MALLOC_FUNCS & MALLOC_FUNCS_INIT
    1.40 +MALLOC_DECL(init, void, const malloc_table_t *)
    1.41 +#  endif
    1.42 +#  if MALLOC_FUNCS & MALLOC_FUNCS_MALLOC
    1.43 +MALLOC_DECL(malloc, void *, size_t)
    1.44 +MALLOC_DECL(posix_memalign, int, void **, size_t, size_t)
    1.45 +MALLOC_DECL(aligned_alloc, void *, size_t, size_t)
    1.46 +MALLOC_DECL(calloc, void *, size_t, size_t)
    1.47 +MALLOC_DECL(realloc, void *, void *, size_t)
    1.48 +MALLOC_DECL(free, void, void *)
    1.49 +MALLOC_DECL(memalign, void *, size_t, size_t)
    1.50 +MALLOC_DECL(valloc, void *, size_t)
    1.51 +MALLOC_DECL(malloc_usable_size, size_t, usable_ptr_t)
    1.52 +MALLOC_DECL(malloc_good_size, size_t, size_t)
    1.53 +#  endif
    1.54 +#  if MALLOC_FUNCS & MALLOC_FUNCS_JEMALLOC
    1.55 +MALLOC_DECL(jemalloc_stats, void, jemalloc_stats_t *)
    1.56 +MALLOC_DECL(jemalloc_purge_freed_pages, void, void)
    1.57 +MALLOC_DECL(jemalloc_free_dirty_pages, void, void)
    1.58 +#  endif
    1.59 +#endif /* MALLOC_DECL */
    1.60 +
    1.61 +#undef MALLOC_DECL
    1.62 +#undef MALLOC_FUNCS

mercurial