aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-10-12 20:49:06 +0000
committerUlrich Drepper <drepper@redhat.com>2005-10-12 20:49:06 +0000
commit04ec80e410b4efb0576a2ffd0d2f29ed1fdac451 (patch)
treec5e89f2383061bd79f962589585d5e601825f4e8
parent9bf248c6c6290a2a8a729f10f1d94258868a0650 (diff)
downloadglibc-04ec80e410b4efb0576a2ffd0d2f29ed1fdac451.tar
glibc-04ec80e410b4efb0576a2ffd0d2f29ed1fdac451.tar.gz
glibc-04ec80e410b4efb0576a2ffd0d2f29ed1fdac451.tar.bz2
glibc-04ec80e410b4efb0576a2ffd0d2f29ed1fdac451.zip
* include/malloc.h: Remove _int_new_arena prototype.
* malloc/arena.c (_int_new_arena): Move definition ahead of arena_get2 and make static.
-rw-r--r--ChangeLog4
-rw-r--r--include/malloc.h1
-rw-r--r--malloc/arena.c84
3 files changed, 46 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 19c3f47be9..a956c55002 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2005-10-12 Ulrich Drepper <drepper@redhat.com>
+ * include/malloc.h: Remove _int_new_arena prototype.
+ * malloc/arena.c (_int_new_arena): Move definition ahead of
+ arena_get2 and make static.
+
Correctly implement M_MXFAST.
* malloc/malloc.c (struct malloc_state): Replace max_fast with flags
fields.
diff --git a/include/malloc.h b/include/malloc.h
index f0164a6273..1a20248559 100644
--- a/include/malloc.h
+++ b/include/malloc.h
@@ -12,7 +12,6 @@ extern int __malloc_initialized attribute_hidden;
struct malloc_state;
typedef struct malloc_state *mstate;
-extern mstate _int_new_arena (size_t __ini_size) attribute_hidden;
extern __malloc_ptr_t _int_malloc (mstate __m, size_t __size) attribute_hidden;
extern void _int_free (mstate __m, __malloc_ptr_t __ptr)
attribute_hidden;
diff --git a/malloc/arena.c b/malloc/arena.c
index 039d70ff18..abbca1f02e 100644
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -786,6 +786,48 @@ heap_trim(heap, pad) heap_info *heap; size_t pad;
return 1;
}
+/* Create a new arena with initial size "size". */
+
+static mstate
+_int_new_arena(size_t size)
+{
+ mstate a;
+ heap_info *h;
+ char *ptr;
+ unsigned long misalign;
+
+ h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT),
+ mp_.top_pad);
+ if(!h) {
+ /* Maybe size is too large to fit in a single heap. So, just try
+ to create a minimally-sized arena and let _int_malloc() attempt
+ to deal with the large request via mmap_chunk(). */
+ h = new_heap(sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT, mp_.top_pad);
+ if(!h)
+ return 0;
+ }
+ a = h->ar_ptr = (mstate)(h+1);
+ malloc_init_state(a);
+ /*a->next = NULL;*/
+ a->system_mem = a->max_system_mem = h->size;
+ arena_mem += h->size;
+#ifdef NO_THREADS
+ if((unsigned long)(mp_.mmapped_mem + arena_mem + main_arena.system_mem) >
+ mp_.max_total_mem)
+ mp_.max_total_mem = mp_.mmapped_mem + arena_mem + main_arena.system_mem;
+#endif
+
+ /* Set up the top chunk, with proper alignment. */
+ ptr = (char *)(a + 1);
+ misalign = (unsigned long)chunk2mem(ptr) & MALLOC_ALIGN_MASK;
+ if (misalign > 0)
+ ptr += MALLOC_ALIGNMENT - misalign;
+ top(a) = (mchunkptr)ptr;
+ set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
+
+ return a;
+}
+
static mstate
internal_function
#if __STD_C
@@ -856,48 +898,6 @@ arena_get2(a_tsd, size) mstate a_tsd; size_t size;
return a;
}
-/* Create a new arena with initial size "size". */
-
-mstate
-_int_new_arena(size_t size)
-{
- mstate a;
- heap_info *h;
- char *ptr;
- unsigned long misalign;
-
- h = new_heap(size + (sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT),
- mp_.top_pad);
- if(!h) {
- /* Maybe size is too large to fit in a single heap. So, just try
- to create a minimally-sized arena and let _int_malloc() attempt
- to deal with the large request via mmap_chunk(). */
- h = new_heap(sizeof(*h) + sizeof(*a) + MALLOC_ALIGNMENT, mp_.top_pad);
- if(!h)
- return 0;
- }
- a = h->ar_ptr = (mstate)(h+1);
- malloc_init_state(a);
- /*a->next = NULL;*/
- a->system_mem = a->max_system_mem = h->size;
- arena_mem += h->size;
-#ifdef NO_THREADS
- if((unsigned long)(mp_.mmapped_mem + arena_mem + main_arena.system_mem) >
- mp_.max_total_mem)
- mp_.max_total_mem = mp_.mmapped_mem + arena_mem + main_arena.system_mem;
-#endif
-
- /* Set up the top chunk, with proper alignment. */
- ptr = (char *)(a + 1);
- misalign = (unsigned long)chunk2mem(ptr) & MALLOC_ALIGN_MASK;
- if (misalign > 0)
- ptr += MALLOC_ALIGNMENT - misalign;
- top(a) = (mchunkptr)ptr;
- set_head(top(a), (((char*)h + h->size) - ptr) | PREV_INUSE);
-
- return a;
-}
-
#endif /* USE_ARENAS */
/*