xref: /aosp_15_r20/external/jemalloc_new/include/jemalloc/jemalloc_mangle.h (revision 1208bc7e437ced7eb82efac44ba17e3beba411da)
1  /*
2   * By default application code must explicitly refer to mangled symbol names,
3   * so that it is possible to use jemalloc in conjunction with another allocator
4   * in the same application.  Define JEMALLOC_MANGLE in order to cause automatic
5   * name mangling that matches the API prefixing that happened as a result of
6   * --with-mangling and/or --with-jemalloc-prefix configuration settings.
7   */
8  #ifdef JEMALLOC_MANGLE
9  #  ifndef JEMALLOC_NO_DEMANGLE
10  #    define JEMALLOC_NO_DEMANGLE
11  #  endif
12  #  define aligned_alloc je_aligned_alloc
13  #  define calloc je_calloc
14  #  define dallocx je_dallocx
15  #  define free je_free
16  #  define mallctl je_mallctl
17  #  define mallctlbymib je_mallctlbymib
18  #  define mallctlnametomib je_mallctlnametomib
19  #  define malloc je_malloc
20  #  define malloc_conf je_malloc_conf
21  #  define malloc_message je_malloc_message
22  #  define malloc_stats_print je_malloc_stats_print
23  #  define malloc_usable_size je_malloc_usable_size
24  #  define mallocx je_mallocx
25  #  define nallocx je_nallocx
26  #  define posix_memalign je_posix_memalign
27  #  define rallocx je_rallocx
28  #  define realloc je_realloc
29  #  define sallocx je_sallocx
30  #  define sdallocx je_sdallocx
31  #  define xallocx je_xallocx
32  #  define memalign je_memalign
33  #  define valloc je_valloc
34  #endif
35  
36  /*
37   * The je_* macros can be used as stable alternative names for the
38   * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined.  This is primarily
39   * meant for use in jemalloc itself, but it can be used by application code to
40   * provide isolation from the name mangling specified via --with-mangling
41   * and/or --with-jemalloc-prefix.
42   */
43  #ifndef JEMALLOC_NO_DEMANGLE
44  #  undef je_aligned_alloc
45  #  undef je_calloc
46  #  undef je_dallocx
47  #  undef je_free
48  #  undef je_mallctl
49  #  undef je_mallctlbymib
50  #  undef je_mallctlnametomib
51  #  undef je_malloc
52  #  undef je_malloc_conf
53  #  undef je_malloc_message
54  #  undef je_malloc_stats_print
55  #  undef je_malloc_usable_size
56  #  undef je_mallocx
57  #  undef je_nallocx
58  #  undef je_posix_memalign
59  #  undef je_rallocx
60  #  undef je_realloc
61  #  undef je_sallocx
62  #  undef je_sdallocx
63  #  undef je_xallocx
64  #  undef je_memalign
65  #  undef je_valloc
66  #endif
67