Hide smallocx even when enabled from the library API

The experimental `smallocx` API is not exposed via header files,
requiring the users to peek at `jemalloc`'s source code to manually
add the external declarations to their own programs.

This should reinforce that `smallocx` is experimental, and that `jemalloc`
does not offer any kind of backwards compatiblity or ABI gurantees for it.
This commit is contained in:
gnzlbg 2018-07-11 21:39:44 +02:00 committed by Jason Evans
parent 730e57b08f
commit 741fca1bb7
4 changed files with 12 additions and 11 deletions

View File

@ -28,10 +28,6 @@ JEMALLOC_EXPORT void JEMALLOC_NOTHROW @je_@free(void *ptr)
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *@je_@mallocx(size_t size, int flags) void JEMALLOC_NOTHROW *@je_@mallocx(size_t size, int flags)
JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1); JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
#ifdef JEMALLOC_EXPERIMENTAL_SMALLOCX_API
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
smallocx_return_t JEMALLOC_NOTHROW @je_@smallocx(size_t size, int flags);
#endif
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_NOTHROW *@je_@rallocx(void *ptr, size_t size, void JEMALLOC_NOTHROW *@je_@rallocx(void *ptr, size_t size,
int flags) JEMALLOC_ALLOC_SIZE(2); int flags) JEMALLOC_ALLOC_SIZE(2);

View File

@ -75,10 +75,3 @@ struct extent_hooks_s {
extent_split_t *split; extent_split_t *split;
extent_merge_t *merge; extent_merge_t *merge;
}; };
#ifdef JEMALLOC_EXPERIMENTAL_SMALLOCX_API
typedef struct {
void *ptr;
size_t size;
} smallocx_return_t;
#endif

View File

@ -2770,6 +2770,11 @@ int __posix_memalign(void** r, size_t a, size_t s) PREALIAS(je_posix_memalign);
*/ */
#ifdef JEMALLOC_EXPERIMENTAL_SMALLOCX_API #ifdef JEMALLOC_EXPERIMENTAL_SMALLOCX_API
typedef struct {
void *ptr;
size_t size;
} smallocx_return_t;
JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
smallocx_return_t JEMALLOC_NOTHROW smallocx_return_t JEMALLOC_NOTHROW
/* /*

View File

@ -1,5 +1,12 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
typedef struct {
void *ptr;
size_t size;
} smallocx_return_t;
extern smallocx_return_t smallocx(size_t size, int flags);
static unsigned static unsigned
get_nsizes_impl(const char *cmd) { get_nsizes_impl(const char *cmd) {
unsigned ret; unsigned ret;