/* Malloc implementation for multiple threads without lock contention.
- Copyright (C) 2001-2006, 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2001-2009, 2011, 2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Wolfram Gloger <wg@malloc.de>, 2001.
mem2mem_check(void *ptr, size_t sz)
{
mchunkptr p;
- unsigned char* m_ptr = (unsigned char*)BOUNDED_N(ptr, sz);
+ unsigned char* m_ptr = ptr;
size_t i;
if (!ptr)
if (top_check() >= 0)
newmem = _int_malloc(&main_arena, bytes+1);
if (newmem) {
- MALLOC_COPY(BOUNDED_N(newmem, bytes+1), oldmem, oldsize - 2*SIZE_SZ);
+ MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ);
munmap_chunk(oldp);
}
}
Configuration and functionality options:
- USE_DL_PREFIX NOT defined
USE_PUBLIC_MALLOC_WRAPPERS NOT defined
USE_MALLOC_LOCK NOT defined
MALLOC_DEBUG NOT defined
#include <ldsodefs.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <unistd.h>
#include <stdio.h> /* needed for malloc_stats */
#include <errno.h>
/* For va_arg, va_start, va_end. */
#include <stdarg.h>
-/* For writev and struct iovec. */
-#include <sys/uio.h>
-/* For syslog. */
-#include <sys/syslog.h>
-
-/* For various dynamic linking things. */
-#include <dlfcn.h>
-
/*
Debugging:
/*
- USE_DL_PREFIX will prefix all public routines with the string 'dl'.
- This is necessary when you only want to use this malloc in one part
- of a program, using your regular system malloc elsewhere.
-*/
-
-/* #define USE_DL_PREFIX */
-
-
-/*
Two-phase name translation.
All of the actual routines are given mangled names.
When wrappers are used, they become the public callable versions.
- When DL_PREFIX is used, the callable names are prefixed.
*/
-#ifdef USE_DL_PREFIX
-#define public_cALLOc dlcalloc
-#define public_fREe dlfree
-#define public_cFREe dlcfree
-#define public_mALLOc dlmalloc
-#define public_mEMALIGn dlmemalign
-#define public_rEALLOc dlrealloc
-#define public_vALLOc dlvalloc
-#define public_pVALLOc dlpvalloc
-#define public_mALLINFo dlmallinfo
-#define public_mALLOPt dlmallopt
-#define public_mTRIm dlmalloc_trim
-#define public_mSTATs dlmalloc_stats
-#define public_mUSABLe dlmalloc_usable_size
-#define public_iCALLOc dlindependent_calloc
-#define public_iCOMALLOc dlindependent_comalloc
-#define public_gET_STATe dlget_state
-#define public_sET_STATe dlset_state
-#else /* USE_DL_PREFIX */
-
/* Special defines for the GNU C library. */
#define public_cALLOc __libc_calloc
#define public_fREe __libc_free
void * __default_morecore (ptrdiff_t);
void *(*__morecore)(ptrdiff_t) = __default_morecore;
-#endif /* USE_DL_PREFIX */
-
#include <string.h>
#define DEFAULT_MMAP_MAX (65536)
#endif
-#ifdef __cplusplus
-} /* end of extern "C" */
-#endif
-
#include <malloc.h>
-#ifndef BOUNDED_N
-#define BOUNDED_N(ptr, sz) (ptr)
-#endif
#ifndef RETURN_ADDRESS
#define RETURN_ADDRESS(X_) (NULL)
#endif