X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;ds=sidebyside;f=opt%2Fdlmalloc%2Fdlmalloc.h;h=b79a83e24bd1d517b32634dad097490524030ef2;hb=da0f3f353d417fed71f358a48d5d5394145e460d;hp=374fa49310275d745ba5ebd9ce297e899d70d0ba;hpb=5155ca96295a12b4857fc0e6a9629cc43a9a85fa;p=pdclib diff --git a/opt/dlmalloc/dlmalloc.h b/opt/dlmalloc/dlmalloc.h index 374fa49..b79a83e 100644 --- a/opt/dlmalloc/dlmalloc.h +++ b/opt/dlmalloc/dlmalloc.h @@ -1,6 +1,6 @@ -#include <_PDCLIB_aux.h> -#include <_PDCLIB_config.h> -#include <_PDCLIB_glue.h> +#include "_PDCLIB_aux.h" +#include "_PDCLIB_config.h" +#include "_PDCLIB_glue.h" #include typedef mtx_t MLOCK_T; @@ -18,7 +18,13 @@ static void init_malloc_global_mutex(void) mtx_init(&malloc_global_mutex, mtx_plain); } -#define MMAP(s) _PDCLIB_allocpages((s)/_PDCLIB_MALLOC_PAGESIZE) +static inline void *MMAP( size_t nbytes ) +{ + void *p = _PDCLIB_allocpages( nbytes / _PDCLIB_MALLOC_PAGESIZE ); + return p ? p : (void*) (~(size_t)0); +} + +#define MMAP(s) MMAP(s) #define DIRECT_MMAP(s) MMAP(s) #define MUNMAP(a, s) ((_PDCLIB_freepages((a), (s)/_PDCLIB_MALLOC_PAGESIZE)), 0) #define MREMAP(a, osz, nsz, mv) _PDCLIB_reallocpages((a), (osz)/_PDCLIB_MALLOC_PAGESIZE, (nsz)/_PDCLIB_MALLOC_PAGESIZE, (mv)) @@ -67,7 +73,7 @@ static void init_malloc_global_mutex(void) #define MAX_RELEASE_CHECK_RATE _PDCLIB_MALLOC_RELEASE_CHECK_RATE /* C standard says this is so */ -#define REALLOC_ZERO_BYTES_FREES 1 +#define REALLOC_ZERO_BYTES_FREES 1 #define LACKS_UNISTD_H #define LACKS_FCNTL_H #define LACKS_SYS_PARAM_H @@ -76,4 +82,4 @@ static void init_malloc_global_mutex(void) #define LACKS_SYS_TYPES_H #define LACKS_SCHED_H #include -#include \ No newline at end of file +#include