aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--malloc/hooks.c6
-rw-r--r--malloc/malloc.c52
3 files changed, 6 insertions, 55 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f06b9a..3d847a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2012-01-16 Ulrich Drepper <drepper@gmail.com>
+ * malloc/malloc.c: Various cleanups.
+ * malloc/hooks.c: Likewise.
+
* stdlib/Makefile (tests): Add bug-fmtmsg1.
* stdlib/bug-fmtmsg1.c: New file.
diff --git a/malloc/hooks.c b/malloc/hooks.c
index fc46e7d..e38644d 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -1,5 +1,5 @@
/* 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.
@@ -98,7 +98,7 @@ internal_function
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)
@@ -302,7 +302,7 @@ realloc_check(void* oldmem, size_t bytes, const void *caller)
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);
}
}
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 6bacb12..5719148 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -179,7 +179,6 @@
Configuration and functionality options:
- USE_DL_PREFIX NOT defined
USE_PUBLIC_MALLOC_WRAPPERS NOT defined
USE_MALLOC_LOCK NOT defined
MALLOC_DEBUG NOT defined
@@ -226,10 +225,6 @@
#include <ldsodefs.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
#include <unistd.h>
#include <stdio.h> /* needed for malloc_stats */
#include <errno.h>
@@ -240,14 +235,6 @@ extern "C" {
/* 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:
@@ -401,41 +388,11 @@ __malloc_assert (const char *assertion, const char *file, unsigned int line,
/*
- 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
@@ -465,8 +422,6 @@ __malloc_assert (const char *assertion, const char *file, unsigned int line,
void * __default_morecore (ptrdiff_t);
void *(*__morecore)(ptrdiff_t) = __default_morecore;
-#endif /* USE_DL_PREFIX */
-
#include <string.h>
@@ -1112,15 +1067,8 @@ int __posix_memalign(void **, size_t, size_t);
#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