summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-10-01 23:51:18 +0000
committerUlrich Drepper <drepper@redhat.com>2004-10-01 23:51:18 +0000
commit8088488d6d4a50e82a72074cc4b01949b7e3c1c1 (patch)
tree6dea1f70a79ad300bd897d299c32a47314875d55
parentf1d877e18b03a316276ded8d7183c7e0a6f95cb4 (diff)
downloadglibc-8088488d6d4a50e82a72074cc4b01949b7e3c1c1.tar.gz
glibc-8088488d6d4a50e82a72074cc4b01949b7e3c1c1.tar.xz
glibc-8088488d6d4a50e82a72074cc4b01949b7e3c1c1.zip
(public_vALLOc): Add missing use of hooks. (public_pVALLOc): Likewise.
-rw-r--r--malloc/malloc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index dcc54c46f1..a41171490a 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1709,7 +1709,7 @@ struct malloc_chunk {
     chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |             Size of previous chunk, if allocated            | |
             +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
-            |             Size of chunk, in bytes                         |P|
+            |             Size of chunk, in bytes                       |M|P|
       mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
             |             User data starts here...                          .
             .                                                               .
@@ -1771,7 +1771,7 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
         MINSIZE bytes long, it is replenished.
 
      2. Chunks allocated via mmap, which have the second-lowest-order
-        bit (IS_MMAPPED) set in their size fields.  Because they are
+        bit M (IS_MMAPPED) set in their size fields.  Because they are
         allocated one-by-one, each must contain its own trailing size field.
 
 */
@@ -3530,6 +3530,13 @@ public_vALLOc(size_t bytes)
 
   if(__malloc_initialized < 0)
     ptmalloc_init ();
+
+  __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
+					__const __malloc_ptr_t)) =
+    __memalign_hook;
+  if (hook != NULL)
+    return (*hook)(mp_.pagesize, bytes, RETURN_ADDRESS (0));
+
   arena_get(ar_ptr, bytes + mp_.pagesize + MINSIZE);
   if(!ar_ptr)
     return 0;
@@ -3546,6 +3553,15 @@ public_pVALLOc(size_t bytes)
 
   if(__malloc_initialized < 0)
     ptmalloc_init ();
+
+  __malloc_ptr_t (*hook) __MALLOC_PMT ((size_t, size_t,
+					__const __malloc_ptr_t)) =
+    __memalign_hook;
+  if (hook != NULL)
+    return (*hook)(mp_.pagesize,
+		   (bytes + mp_.pagesize - 1) & ~(mp_.pagesize - 1),
+		   RETURN_ADDRESS (0));
+
   arena_get(ar_ptr, bytes + 2*mp_.pagesize + MINSIZE);
   p = _int_pvalloc(ar_ptr, bytes);
   (void)mutex_unlock(&ar_ptr->mutex);