From f947748c745a021a7d29f557d4fa759426ed0eee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 13 Aug 2004 18:36:54 +0000 Subject: [PATCH] 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 --- src/kernel/libroot/posix/stdlib/exit.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/kernel/libroot/posix/stdlib/exit.c b/src/kernel/libroot/posix/stdlib/exit.c index 19f67e74ea..d1906200d1 100644 --- a/src/kernel/libroot/posix/stdlib/exit.c +++ b/src/kernel/libroot/posix/stdlib/exit.c @@ -1,8 +1,9 @@ /* -** Copyright 2002-2004, The OpenBeOS Team. All rights reserved. -** Distributed under the terms of the OpenBeOS License. +** Copyright 2002-2004, The Haiku Team. All rights reserved. +** Distributed under the terms of the Haiku License. ** ** Author(s): Daniel Reinhold (danielre@users.sf.net) +** Axel Dörfler, axeld@pinc-software.de ** */ @@ -18,11 +19,11 @@ #include -extern void (*_IO_cleanup)(void); +extern void _IO_cleanup(void); extern void _thread_do_exit_notification(void); -static void (*_gExitStack[ATEXIT_MAX])(void) = {0}; -static int32 _gExitStackIndex = 0; +static void (*sExitStack[ATEXIT_MAX])(void) = {0}; +static int32 sExitStackIndex = 0; void @@ -37,12 +38,12 @@ int atexit(void (*func)(void)) { // push the function pointer onto the exit stack - int32 index = atomic_add(&_gExitStackIndex, 1); + int32 index = atomic_add(&sExitStackIndex, 1); if (index >= ATEXIT_MAX) return -1; - _gExitStack[index] = func; + sExitStack[index] = func; return 0; } @@ -54,8 +55,8 @@ exit(int status) _thread_do_exit_notification(); // unwind the exit stack, calling the registered functions - while (_gExitStackIndex-- > 0) - (*_gExitStack[_gExitStackIndex])(); + while (sExitStackIndex-- > 0) + (*sExitStack[sExitStackIndex])(); // close all open files _IO_cleanup();