-#ifdef DOUG_LEA_MALLOC
-
-/* malloc can be invoked even before main (e.g. by the dynamic
- linker), so the dumped malloc state must be restored as early as
- possible using this special hook. */
-
-static void
-malloc_initialize_hook (void)
-{
- if (initialized)
- {
- if (!malloc_using_checking)
- /* Work around a bug in glibc's malloc. MALLOC_CHECK_ must be
- ignored if the heap to be restored was constructed without
- malloc checking. Can't use unsetenv, since that calls malloc. */
- {
- char **p;
-
- for (p = environ; p && *p; p++)
- if (strncmp (*p, "MALLOC_CHECK_=", 14) == 0)
- {
- do
- *p = p[1];
- while (*++p);
- break;
- }
- }
-
- malloc_set_state (malloc_state_ptr);
-#ifndef XMALLOC_OVERRUN_CHECK
- free (malloc_state_ptr);
-#endif
- }
- else
- {
- if (my_heap_start == 0)
- my_heap_start = sbrk (0);
- malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
- }
-}
-
-void (*__malloc_initialize_hook) (void) EXTERNALLY_VISIBLE = malloc_initialize_hook;
-
-#endif /* DOUG_LEA_MALLOC */
-