X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fdlmalloc%2Fdlmalloc.c;h=54703d480f5c5e89acf656a0f11c6a691930c107;hp=e0bebcdff03539b030fe03da8b88ce4c259208f6;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hpb=56ece6bba2a8516d3a4fa881689df66bca5284d2 diff --git a/opt/dlmalloc/dlmalloc.c b/opt/dlmalloc/dlmalloc.c index e0bebcd..54703d4 100644 --- a/opt/dlmalloc/dlmalloc.c +++ b/opt/dlmalloc/dlmalloc.c @@ -814,7 +814,7 @@ extern "C" { #define dlcalloc calloc #define dlfree free #define dlmalloc malloc -#define dlmemalign memalign +#define dlmemalign aligned_alloc #define dlposix_memalign posix_memalign #define dlrealloc realloc #define dlrealloc_in_place realloc_in_place @@ -835,6 +835,8 @@ extern "C" { #define dlbulk_free bulk_free #endif /* USE_DL_PREFIX */ +#if 0 // Redeclaration warnings as PDCLib already declares these in + /* malloc(size_t n) Returns a pointer to a newly allocated chunk of at least n bytes, or @@ -891,6 +893,22 @@ DLMALLOC_EXPORT void* dlcalloc(size_t, size_t); */ DLMALLOC_EXPORT void* dlrealloc(void*, size_t); +/* + memalign(size_t alignment, size_t n); + Returns a pointer to a newly allocated chunk of n bytes, aligned + in accord with the alignment argument. + + The alignment argument should be a power of two. If the argument is + not a power of two, the nearest greater power is used. + 8-byte alignment is guaranteed by normal malloc calls, so don't + bother calling memalign with an argument of 8 or less. + + Overreliance on memalign is a sure way to fragment space. +*/ +DLMALLOC_EXPORT void* dlmemalign(size_t, size_t); + +#endif + /* realloc_in_place(void* p, size_t n) Resizes the space allocated for p to size n, only if this can be @@ -906,20 +924,6 @@ DLMALLOC_EXPORT void* dlrealloc(void*, size_t); */ DLMALLOC_EXPORT void* dlrealloc_in_place(void*, size_t); -/* - memalign(size_t alignment, size_t n); - Returns a pointer to a newly allocated chunk of n bytes, aligned - in accord with the alignment argument. - - The alignment argument should be a power of two. If the argument is - not a power of two, the nearest greater power is used. - 8-byte alignment is guaranteed by normal malloc calls, so don't - bother calling memalign with an argument of 8 or less. - - Overreliance on memalign is a sure way to fragment space. -*/ -DLMALLOC_EXPORT void* dlmemalign(size_t, size_t); - /* int posix_memalign(void** pp, size_t alignment, size_t n); Allocates a chunk of n bytes, aligned in accord with the alignment @@ -3836,7 +3840,7 @@ static void* mmap_alloc(mstate m, size_t nb) { /* Realloc using mmap */ static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb, int flags) { size_t oldsize = chunksize(oldp); - flags = flags; /* placate people compiling -Wunused */ + (void) flags; if (is_small(nb)) /* Can't shrink mmap regions below small size */ return 0; /* Keep old chunk if big enough but not too big */ @@ -6254,7 +6258,7 @@ History: #endif #ifdef TEST -#include <_PDCLIB_test.h> +#include "_PDCLIB_test.h" /* TODO: TEST ME */ int main( void ) @@ -6262,4 +6266,4 @@ int main( void ) return TEST_RESULTS; } -#endif \ No newline at end of file +#endif