X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=opt%2Fdlmalloc%2Fdlmalloc.c;h=865b5b95afa46c04084dc241ceff38589d160b17;hp=32c3c35686d582443a7a2f3033936c7e87506207;hb=3a988bf47bda2322d7759d3c4518c03e0ef98ba4;hpb=7015f5842d05bd5da32523048e4260e60e9e310c diff --git a/opt/dlmalloc/dlmalloc.c b/opt/dlmalloc/dlmalloc.c index 32c3c35..865b5b9 100644 --- a/opt/dlmalloc/dlmalloc.c +++ b/opt/dlmalloc/dlmalloc.c @@ -516,6 +516,7 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP improvement at the expense of carrying around more memory. */ +#ifndef REGTEST #include "dlmalloc.h" /* Version identifier to allow people to support multiple versions */ @@ -834,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 @@ -890,6 +893,8 @@ DLMALLOC_EXPORT void* dlcalloc(size_t, size_t); */ DLMALLOC_EXPORT void* dlrealloc(void*, 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 @@ -1643,7 +1648,6 @@ unsigned char _BitScanReverse(unsigned long *index, unsigned long mask); is unlikely to be needed, but is supplied just in case. */ #define MMAP_FLAGS (MAP_PRIVATE) -static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ #define MMAP_DEFAULT(s) ((dev_zero_fd < 0) ? \ (dev_zero_fd = open("/dev/zero", O_RDWR), \ mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ @@ -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 */ @@ -6251,3 +6255,15 @@ History: structure of old version, but most details differ.) */ +#endif + +#ifdef TEST +#include <_PDCLIB_test.h> + +/* TODO: TEST ME */ +int main( void ) +{ + return TEST_RESULTS; +} + +#endif