+2013-12-10 Ondřej Bílka <neleai@seznam.cz>
+
+ * malloc/malloc.c (MALLOC_COPY, MALLOC_ZERO): Delete.
+ (__malloc_assert, __libc_realloc, __libc_calloc,
+ _int_realloc): Expand MALLOC_COPY and MALLOC_ZERO to
+ memcpy and memset.
+ * malloc/hooks.c (realloc_check): Likewise.
+
2013-12-10 Ondřej Bílka <neleai@seznam.cz>
* malloc/Makefile (CPPFLAGS-malloc.c): Remove -DPER_THREAD flag.
static void free_atfork(void* mem, const void *caller);
#endif
-
-/* ------------- Optional versions of memcopy ---------------- */
-
-
-/*
- Note: memcpy is ONLY invoked with non-overlapping regions,
- so the (usually slower) memmove is not needed.
-*/
-
-#define MALLOC_COPY(dest, src, nbytes) memcpy(dest, src, nbytes)
-#define MALLOC_ZERO(dest, nbytes) memset(dest, 0, nbytes)
-
-
/* ------------------ MMAP support ------------------ */
/* Must alloc, copy, free. */
newmem = __libc_malloc(bytes);
if (newmem == 0) return 0; /* propagate failure */
- MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ);
+ memcpy(newmem, oldmem, oldsize - 2*SIZE_SZ);
munmap_chunk(oldp);
return newmem;
}
newp = __libc_malloc(bytes);
if (newp != NULL)
{
- MALLOC_COPY (newp, oldmem, oldsize - SIZE_SZ);
+ memcpy (newp, oldmem, oldsize - SIZE_SZ);
_int_free(ar_ptr, oldp, 0);
}
}
if (chunk_is_mmapped (p))
{
if (__builtin_expect (perturb_byte, 0))
- return MALLOC_ZERO (mem, sz);
+ return memset (mem, 0, sz);
return mem;
}
assert(nclears >= 3);
if (nclears > 9)
- return MALLOC_ZERO(d, clearsize);
+ return memset(d, 0, clearsize);
else {
*(d+0) = 0;
assert(ncopies >= 3);
if (ncopies > 9)
- MALLOC_COPY(d, s, copysize);
+ memcpy(d, s, copysize);
else {
*(d+0) = *(s+0);