Bug 1052573 - Separate the base allocator functions in malloc_decls.h. r?njn
malloc, free, calloc, realloc and memalign constitute some sort of
minimal interface to the allocator. posix_memalign, aligned_alloc and
valloc are already defined in terms of memalign. The remaining functions
are not related to active allocation.
--- a/memory/build/malloc_decls.h
+++ b/memory/build/malloc_decls.h
@@ -10,44 +10,49 @@
* - argument types
*/
#ifndef malloc_decls_h
# define malloc_decls_h
# include "mozjemalloc_types.h"
-# define MALLOC_FUNCS_MALLOC 1
-# define MALLOC_FUNCS_JEMALLOC 2
-# define MALLOC_FUNCS_INIT 4
-# define MALLOC_FUNCS_BRIDGE 8
+# define MALLOC_FUNCS_MALLOC_BASE 1
+# define MALLOC_FUNCS_MALLOC_EXTRA 2
+# define MALLOC_FUNCS_MALLOC (MALLOC_FUNCS_MALLOC_BASE | \
+ MALLOC_FUNCS_MALLOC_EXTRA)
+# define MALLOC_FUNCS_JEMALLOC 4
+# define MALLOC_FUNCS_INIT 8
+# define MALLOC_FUNCS_BRIDGE 16
# define MALLOC_FUNCS_ALL (MALLOC_FUNCS_INIT | MALLOC_FUNCS_BRIDGE | \
MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC)
#endif /* malloc_decls_h */
#ifndef MALLOC_FUNCS
# define MALLOC_FUNCS (MALLOC_FUNCS_MALLOC | MALLOC_FUNCS_JEMALLOC)
#endif
#ifdef MALLOC_DECL
# if MALLOC_FUNCS & MALLOC_FUNCS_INIT
MALLOC_DECL(init, void, const malloc_table_t *)
# endif
# if MALLOC_FUNCS & MALLOC_FUNCS_BRIDGE
MALLOC_DECL(get_bridge, struct ReplaceMallocBridge*)
# endif
-# if MALLOC_FUNCS & MALLOC_FUNCS_MALLOC
+# if MALLOC_FUNCS & MALLOC_FUNCS_MALLOC_BASE
MALLOC_DECL(malloc, void *, size_t)
-MALLOC_DECL(posix_memalign, int, void **, size_t, size_t)
-MALLOC_DECL(aligned_alloc, void *, size_t, size_t)
MALLOC_DECL(calloc, void *, size_t, size_t)
MALLOC_DECL(realloc, void *, void *, size_t)
MALLOC_DECL(free, void, void *)
MALLOC_DECL(memalign, void *, size_t, size_t)
+# endif
+# if MALLOC_FUNCS & MALLOC_FUNCS_MALLOC_EXTRA
+MALLOC_DECL(posix_memalign, int, void **, size_t, size_t)
+MALLOC_DECL(aligned_alloc, void *, size_t, size_t)
MALLOC_DECL(valloc, void *, size_t)
MALLOC_DECL(malloc_usable_size, size_t, usable_ptr_t)
MALLOC_DECL(malloc_good_size, size_t, size_t)
# endif
# if MALLOC_FUNCS & MALLOC_FUNCS_JEMALLOC
MALLOC_DECL(jemalloc_stats, void, jemalloc_stats_t *)
/*
* On some operating systems (Mac), we use madvise(MADV_FREE) to hand pages