Add relevant function attributes to [msn]allocx().

This commit is contained in:
Jason Evans 2014-09-08 16:47:51 -07:00
parent a1f3929ffd
commit c3f8650749
2 changed files with 15 additions and 20 deletions

View File

@ -17,13 +17,16 @@ JEMALLOC_EXPORT void *@je_@aligned_alloc(size_t alignment, size_t size)
JEMALLOC_EXPORT void *@je_@realloc(void *ptr, size_t size);
JEMALLOC_EXPORT void @je_@free(void *ptr);
JEMALLOC_EXPORT void *@je_@mallocx(size_t size, int flags);
JEMALLOC_EXPORT void *@je_@mallocx(size_t size, int flags)
JEMALLOC_ATTR(malloc);
JEMALLOC_EXPORT void *@je_@rallocx(void *ptr, size_t size, int flags);
JEMALLOC_EXPORT size_t @je_@xallocx(void *ptr, size_t size, size_t extra,
int flags);
JEMALLOC_EXPORT size_t @je_@sallocx(const void *ptr, int flags);
JEMALLOC_EXPORT size_t @je_@sallocx(const void *ptr, int flags)
JEMALLOC_ATTR(pure);
JEMALLOC_EXPORT void @je_@dallocx(void *ptr, int flags);
JEMALLOC_EXPORT size_t @je_@nallocx(size_t size, int flags);
JEMALLOC_EXPORT size_t @je_@nallocx(size_t size, int flags)
JEMALLOC_ATTR(pure);
JEMALLOC_EXPORT int @je_@mallctl(const char *name, void *oldp,
size_t *oldlenp, void *newp, size_t newlen);

View File

@ -81,7 +81,7 @@ TEST_BEGIN(test_free_vs_dallocx)
TEST_END
static void
mus_vs_sallocx_mus(void)
malloc_mus_free(void)
{
void *p;
@ -91,12 +91,13 @@ mus_vs_sallocx_mus(void)
}
static void
mus_vs_sallocx_sallocx(void)
malloc_sallocx_free(void)
{
void *p;
p = malloc(1);
sallocx(p, 0);
if (sallocx(p, 0) < 1)
test_fail("Unexpected sallocx() failure");
free(p);
}
@ -104,27 +105,18 @@ TEST_BEGIN(test_mus_vs_sallocx)
{
compare_funcs(10*1000*1000, 100*1000*1000, "malloc_usable_size",
mus_vs_sallocx_mus, "sallocx", mus_vs_sallocx_sallocx);
malloc_mus_free, "sallocx", malloc_sallocx_free);
}
TEST_END
static void
sallocx_vs_nallocx_sallocx(void)
malloc_nallocx_free(void)
{
void *p;
p = malloc(1);
sallocx(p, 0);
free(p);
}
static void
sallocx_vs_nallocx_nallocx(void)
{
void *p;
p = malloc(1);
nallocx(1, 0);
if (nallocx(1, 0) < 1)
test_fail("Unexpected nallocx() failure");
free(p);
}
@ -132,7 +124,7 @@ TEST_BEGIN(test_sallocx_vs_nallocx)
{
compare_funcs(10*1000*1000, 100*1000*1000, "sallocx",
sallocx_vs_nallocx_sallocx, "nallocx", sallocx_vs_nallocx_nallocx);
malloc_sallocx_free, "nallocx", malloc_nallocx_free);
}
TEST_END