From: Ulrich Drepper Date: Wed, 25 Mar 1998 10:34:44 +0000 (+0000) Subject: __malloc_initialized now signals three states: uninitialized, X-Git-Tag: cvs/before-sparc-2_0_x-branch~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11a25a78069035b662a96643fd8e8a9c75202796;p=thirdparty%2Fglibc.git __malloc_initialized now signals three states: uninitialized, initializing, initialized. Used in mcheck. --- diff --git a/malloc/malloc.c b/malloc/malloc.c index ea92acb323c..057b5a05c04 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -1,5 +1,5 @@ /* Malloc implementation for multiple threads without lock contention. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Wolfram Gloger and Doug Lea , 1996. @@ -1507,7 +1507,7 @@ static unsigned long max_mmapped_mem = 0; #endif /* Already initialized? */ -int __malloc_initialized = 0; +int __malloc_initialized = -1; /* Initialization routine. */ @@ -1529,8 +1529,8 @@ ptmalloc_init __MALLOC_P((void)) const char* s; #endif - if(__malloc_initialized) return; - __malloc_initialized = 1; + if(__malloc_initialized >= 0) return; + __malloc_initialized = 0; #if defined(_LIBC) || defined(MALLOC_HOOKS) /* With some threads implementations, creating thread-specific data or initializing a mutex may call malloc() itself. Provide a @@ -1570,6 +1570,7 @@ ptmalloc_init __MALLOC_P((void)) if(__malloc_initialize_hook != NULL) (*__malloc_initialize_hook)(); #endif + __malloc_initialized = 1; } #if defined(_LIBC) || defined(MALLOC_HOOKS)