* malloc/hooks.c (__malloc_initialize_hook, __free_hook,
authorRoland McGrath <roland@gnu.org>
Fri, 23 Aug 2002 10:53:52 +0000 (10:53 +0000)
committerRoland McGrath <roland@gnu.org>
Fri, 23 Aug 2002 10:53:52 +0000 (10:53 +0000)
__malloc_hook, __realloc_hook, __memalign_hook,
__after_morecore_hook): Variable definitions moved to ...
* malloc/malloc.c: ... here, so as to be before all references.

ChangeLog
malloc/hooks.c
malloc/malloc.c

index 55e1888..c95e6f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2002-08-23  Roland McGrath  <roland@redhat.com>
 
+       * malloc/hooks.c (__malloc_initialize_hook, __free_hook,
+       __malloc_hook, __realloc_hook, __memalign_hook,
+       __after_morecore_hook): Variable definitions moved to ...
+       * malloc/malloc.c: ... here, so as to be before all references.
+
        * sysdeps/i386/dl-machine.h (elf_machine_load_address): Add a dummy
        global variable reference in an unused asm parameter, to ensure the
        compiler has set up the GOT register before we use it.
index 9fab05c..a369803 100644 (file)
 
 /* $Id$ */
 
-#ifndef weak_variable
-#ifndef _LIBC
-#define weak_variable /**/
-#else
-/* In GNU libc we want the hook variables to be weak definitions to
-   avoid a problem with Emacs.  */
-#define weak_variable weak_function
-#endif
-#endif
-
-/* Forward declarations.  */
-static Void_t* malloc_hook_ini __MALLOC_P ((size_t sz,
-                                           const __malloc_ptr_t caller));
-static Void_t* realloc_hook_ini __MALLOC_P ((Void_t* ptr, size_t sz,
-                                            const __malloc_ptr_t caller));
-static Void_t* memalign_hook_ini __MALLOC_P ((size_t alignment, size_t sz,
-                                             const __malloc_ptr_t caller));
-
-/* Define and initialize the hook variables.  These weak definitions must
-   appear before any use of the variables in a function.  */
-void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
-void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
-                                              const __malloc_ptr_t)) = NULL;
-__malloc_ptr_t weak_variable (*__malloc_hook)
- __MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini;
-__malloc_ptr_t weak_variable (*__realloc_hook)
- __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t))
-     = realloc_hook_ini;
-__malloc_ptr_t weak_variable (*__memalign_hook)
- __MALLOC_P ((size_t __alignment, size_t __size, const __malloc_ptr_t))
-     = memalign_hook_ini;
-void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL;
-
-
 #ifndef DEFAULT_CHECK_ACTION
 #define DEFAULT_CHECK_ACTION 1
 #endif
index b6fd367..03c3c9a 100644 (file)
@@ -2263,6 +2263,43 @@ static void     malloc_consolidate();
 static Void_t** iALLOc();
 #endif
 
+
+/* -------------- Early definitions for debugging hooks ---------------- */
+
+/* Define and initialize the hook variables.  These weak definitions must
+   appear before any use of the variables in a function (arena.c uses one).  */
+#ifndef weak_variable
+#ifndef _LIBC
+#define weak_variable /**/
+#else
+/* In GNU libc we want the hook variables to be weak definitions to
+   avoid a problem with Emacs.  */
+#define weak_variable weak_function
+#endif
+#endif
+
+/* Forward declarations.  */
+static Void_t* malloc_hook_ini __MALLOC_P ((size_t sz,
+                                           const __malloc_ptr_t caller));
+static Void_t* realloc_hook_ini __MALLOC_P ((Void_t* ptr, size_t sz,
+                                            const __malloc_ptr_t caller));
+static Void_t* memalign_hook_ini __MALLOC_P ((size_t alignment, size_t sz,
+                                             const __malloc_ptr_t caller));
+
+void weak_variable (*__malloc_initialize_hook) __MALLOC_P ((void)) = NULL;
+void weak_variable (*__free_hook) __MALLOC_P ((__malloc_ptr_t __ptr,
+                                              const __malloc_ptr_t)) = NULL;
+__malloc_ptr_t weak_variable (*__malloc_hook)
+ __MALLOC_P ((size_t __size, const __malloc_ptr_t)) = malloc_hook_ini;
+__malloc_ptr_t weak_variable (*__realloc_hook)
+ __MALLOC_P ((__malloc_ptr_t __ptr, size_t __size, const __malloc_ptr_t))
+     = realloc_hook_ini;
+__malloc_ptr_t weak_variable (*__memalign_hook)
+ __MALLOC_P ((size_t __alignment, size_t __size, const __malloc_ptr_t))
+     = memalign_hook_ini;
+void weak_variable (*__after_morecore_hook) __MALLOC_P ((void)) = NULL;
+
+
 /* ------------------- Support for multiple arenas -------------------- */
 #include "arena.c"