summaryrefslogtreecommitdiffstats
path: root/newlib/libc/stdlib/__atexit.c
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2013-05-07 21:40:10 +0000
committerJeff Johnston <jjohnstn@redhat.com>2013-05-07 21:40:10 +0000
commit6bd6954bdc0f3fc4c952f8066e939f16c69bf13b (patch)
tree0ed52e48761e3323a0e86ec91544cc10ffbcc694 /newlib/libc/stdlib/__atexit.c
parentc0e447afd0d4b671fb55948c4cdb4bee543d0b50 (diff)
downloadcygnal-6bd6954bdc0f3fc4c952f8066e939f16c69bf13b.tar.gz
cygnal-6bd6954bdc0f3fc4c952f8066e939f16c69bf13b.tar.bz2
cygnal-6bd6954bdc0f3fc4c952f8066e939f16c69bf13b.zip
2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/reent.h (_ATEXIT_INIT): Define. (_ATEXIT_INIT_PTR): Likewise. (_REENT_INIT_ATEXIT): Likewise. (_REENT_INIT_ATEXIT_PTR): Likewise. (_GLOBAL_ATEXIT): Likewise. * libc/stdlib/__atexit.c (_GLOBAL_ATEXIT0): Define. (__register_exitproc): Use _GLOBAL_ATEXIT and _GLOBAL_ATEXIT0. * libc/stdlib/__call_atexit.c (__call_exitprocs): Likewise. -
Diffstat (limited to 'newlib/libc/stdlib/__atexit.c')
-rw-r--r--newlib/libc/stdlib/__atexit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c
index 1caf2e56b..a095313d3 100644
--- a/newlib/libc/stdlib/__atexit.c
+++ b/newlib/libc/stdlib/__atexit.c
@@ -15,6 +15,8 @@ void * malloc(size_t) _ATTRIBUTE((__weak__));
extern _LOCK_RECURSIVE_T __atexit_lock;
#endif
+#define _GLOBAL_ATEXIT0 (&_GLOBAL_REENT->_atexit0)
+
/*
* Register a function to be performed at exit or on shared library unload.
*/
@@ -34,9 +36,9 @@ _DEFUN (__register_exitproc,
__lock_acquire_recursive(__atexit_lock);
#endif
- p = _GLOBAL_REENT->_atexit;
+ p = _GLOBAL_ATEXIT;
if (p == NULL)
- _GLOBAL_REENT->_atexit = p = &_GLOBAL_REENT->_atexit0;
+ _GLOBAL_ATEXIT = p = _GLOBAL_ATEXIT0;
if (p->_ind >= _ATEXIT_SIZE)
{
#ifndef _ATEXIT_DYNAMIC_ALLOC
@@ -56,8 +58,8 @@ _DEFUN (__register_exitproc,
return -1;
}
p->_ind = 0;
- p->_next = _GLOBAL_REENT->_atexit;
- _GLOBAL_REENT->_atexit = p;
+ p->_next = _GLOBAL_ATEXIT;
+ _GLOBAL_ATEXIT = p;
#ifndef _REENT_SMALL
p->_on_exit_args._fntypes = 0;
p->_on_exit_args._is_cxa = 0;