aboutsummaryrefslogtreecommitdiff
path: root/malloc/hooks.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2002-08-23 09:46:36 +0000
committerRoland McGrath <roland@gnu.org>2002-08-23 09:46:36 +0000
commit94b68ee9763dcf03839e40e1d77dce357a7a6b11 (patch)
tree882ab757bfbd0eac056230fa18814df4d8abeed5 /malloc/hooks.c
parentc0ad824e402c7afde1b46be1620c70107aa3eda9 (diff)
downloadglibc-94b68ee9763dcf03839e40e1d77dce357a7a6b11.zip
glibc-94b68ee9763dcf03839e40e1d77dce357a7a6b11.tar.gz
glibc-94b68ee9763dcf03839e40e1d77dce357a7a6b11.tar.bz2
2002-08-23 Roland McGrath <roland@redhat.com>
* malloc/hooks.c: Move variable definitions ahead of uses. * libio/fileops.c: Move versioned_symbol defns ahead of _IO_jump_t initializers that make reference to variables they define.
Diffstat (limited to 'malloc/hooks.c')
-rw-r--r--malloc/hooks.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/malloc/hooks.c b/malloc/hooks.c
index feb7b2d..9fab05c 100644
--- a/malloc/hooks.c
+++ b/malloc/hooks.c
@@ -30,6 +30,30 @@
#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
@@ -81,19 +105,6 @@ memalign_hook_ini(alignment, sz, caller)
return public_mEMALIGn(alignment, sz);
}
-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;
-
static int check_action = DEFAULT_CHECK_ACTION;