Fixed wrong function export that made every app crash on exit...

Renamed static variables to have the 's' prefix.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8560 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-08-13 18:36:54 +00:00
parent 7d1a7f96ff
commit f947748c74
+10 -9
View File
@@ -1,8 +1,9 @@
/* /*
** Copyright 2002-2004, The OpenBeOS Team. All rights reserved. ** Copyright 2002-2004, The Haiku Team. All rights reserved.
** Distributed under the terms of the OpenBeOS License. ** Distributed under the terms of the Haiku License.
** **
** Author(s): Daniel Reinhold ([email protected]) ** Author(s): Daniel Reinhold ([email protected])
** Axel Dörfler, [email protected]
** **
*/ */
@@ -18,11 +19,11 @@
#include <limits.h> #include <limits.h>
extern void (*_IO_cleanup)(void); extern void _IO_cleanup(void);
extern void _thread_do_exit_notification(void); extern void _thread_do_exit_notification(void);
static void (*_gExitStack[ATEXIT_MAX])(void) = {0}; static void (*sExitStack[ATEXIT_MAX])(void) = {0};
static int32 _gExitStackIndex = 0; static int32 sExitStackIndex = 0;
void void
@@ -37,12 +38,12 @@ int
atexit(void (*func)(void)) atexit(void (*func)(void))
{ {
// push the function pointer onto the exit stack // push the function pointer onto the exit stack
int32 index = atomic_add(&_gExitStackIndex, 1); int32 index = atomic_add(&sExitStackIndex, 1);
if (index >= ATEXIT_MAX) if (index >= ATEXIT_MAX)
return -1; return -1;
_gExitStack[index] = func; sExitStack[index] = func;
return 0; return 0;
} }
@@ -54,8 +55,8 @@ exit(int status)
_thread_do_exit_notification(); _thread_do_exit_notification();
// unwind the exit stack, calling the registered functions // unwind the exit stack, calling the registered functions
while (_gExitStackIndex-- > 0) while (sExitStackIndex-- > 0)
(*_gExitStack[_gExitStackIndex])(); (*sExitStack[sExitStackIndex])();
// close all open files // close all open files
_IO_cleanup(); _IO_cleanup();