This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] malloc: remove dead code
- From: Joern Engel <joern at purestorage dot com>
- To: "GNU C. Library" <libc-alpha at sourceware dot org>
- Cc: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>, Joern Engel <joern at purestorage dot org>
- Date: Mon, 25 Jan 2016 16:24:47 -0800
- Subject: [PATCH] malloc: remove dead code
- Authentication-results: sourceware.org; auth=none
- References: <1453767942-19369-1-git-send-email-joern at purestorage dot com>
From: Joern Engel <joern@purestorage.org>
JIRA: PURE-27597
---
tpc/malloc2.13/malloc.c | 105 ------------------------------------------------
1 file changed, 105 deletions(-)
diff --git a/tpc/malloc2.13/malloc.c b/tpc/malloc2.13/malloc.c
index f1c7b219a0bd..c366b6085953 100644
--- a/tpc/malloc2.13/malloc.c
+++ b/tpc/malloc2.13/malloc.c
@@ -183,7 +183,6 @@ __declspec(dllexport) void malloc2_13_bogus_symbol()
HAVE_MEMCPY defined
USE_MEMCPY 1 if HAVE_MEMCPY is defined
HAVE_MMAP defined as 1
- MMAP_CLEARS 1
HAVE_MREMAP 0 unless linux defined
USE_ARENAS the same as HAVE_MMAP
malloc_getpagesize derived from system #includes, or 4096 if not
@@ -663,20 +662,6 @@ extern Void_t* sbrk(ptrdiff_t);
#ifndef HAVE_MMAP
#define HAVE_MMAP 1
-
-/*
- Standard unix mmap using /dev/zero clears memory so calloc doesn't
- need to.
-*/
-
-#ifndef MMAP_CLEARS
-#define MMAP_CLEARS 1
-#endif
-
-#else /* no mmap */
-#ifndef MMAP_CLEARS
-#define MMAP_CLEARS 0
-#endif
#endif
@@ -3470,38 +3455,6 @@ public_mALLOc(size_t bytes)
return (*hook)(bytes, RETURN_ADDRESS (0));
arena_lookup(ar_ptr);
-#if 0
- // XXX We need double-word CAS and fastbins must be extended to also
- // XXX hold a generation counter for each entry.
- if (ar_ptr) {
- INTERNAL_SIZE_T nb; /* normalized request size */
- checked_request2size(bytes, nb);
- if (nb <= get_max_fast ()) {
- long int idx = fastbin_index(nb);
- mfastbinptr* fb = &fastbin (ar_ptr, idx);
- mchunkptr pp = *fb;
- mchunkptr v;
- do
- {
- v = pp;
- if (v == NULL)
- break;
- }
- while ((pp = catomic_compare_and_exchange_val_acq (fb, v->fd, v)) != v);
- if (v != 0) {
- if (__builtin_expect (fastbin_index (chunksize (v)) != idx, 0))
- malloc_printerr (check_action, "malloc(): memory corruption (fast)",
- chunk2mem (v));
- check_remalloced_chunk(ar_ptr, v, nb);
- void *p = chunk2mem(v);
- if (__builtin_expect (perturb_byte, 0))
- alloc_perturb (p, bytes);
- return p;
- }
- }
- }
-#endif
-
arena_lock(ar_ptr, bytes);
if(!ar_ptr)
return 0;
@@ -5413,64 +5366,6 @@ _int_memalign(struct malloc_state * av, size_t alignment, size_t bytes)
return chunk2mem(p);
}
-#if 0
-/*
- ------------------------------ calloc ------------------------------
-*/
-
-Void_t* cALLOc(size_t n_elements, size_t elem_size)
-{
- mchunkptr p;
- unsigned long clearsize;
- unsigned long nclears;
- INTERNAL_SIZE_T* d;
-
- Void_t* mem = mALLOc(n_elements * elem_size);
-
- if (mem != 0) {
- p = mem2chunk(mem);
-
-#if MMAP_CLEARS
- if (!chunk_is_mmapped(p)) /* don't need to clear mmapped space */
-#endif
- {
- /*
- Unroll clear of <= 36 bytes (72 if 8byte sizes)
- We know that contents have an odd number of
- INTERNAL_SIZE_T-sized words; minimally 3.
- */
-
- d = (INTERNAL_SIZE_T*)mem;
- clearsize = chunksize(p) - SIZE_SZ;
- nclears = clearsize / sizeof(INTERNAL_SIZE_T);
- assert(nclears >= 3);
-
- if (nclears > 9)
- MALLOC_ZERO(d, clearsize);
-
- else {
- *(d+0) = 0;
- *(d+1) = 0;
- *(d+2) = 0;
- if (nclears > 4) {
- *(d+3) = 0;
- *(d+4) = 0;
- if (nclears > 6) {
- *(d+5) = 0;
- *(d+6) = 0;
- if (nclears > 8) {
- *(d+7) = 0;
- *(d+8) = 0;
- }
- }
- }
- }
- }
- }
- return mem;
-}
-#endif /* 0 */
-
#ifndef _LIBC
/*
------------------------- independent_calloc -------------------------
--
2.7.0.rc3