diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2013-05-08 23:13:51 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2013-05-08 23:13:51 +0000 |
commit | 1b7ad41e50ce327c3258d5a33e2cb86f2c855192 (patch) | |
tree | a1822c535879d5dc3ecbdbf0c15fd11b3cb354f6 /newlib/libc/reent/reent.c | |
parent | ad48b1b79c64baafaa029f67ce83ed5e47286c0b (diff) | |
download | cygnal-1b7ad41e50ce327c3258d5a33e2cb86f2c855192.tar.gz cygnal-1b7ad41e50ce327c3258d5a33e2cb86f2c855192.tar.bz2 cygnal-1b7ad41e50ce327c3258d5a33e2cb86f2c855192.zip |
2013-05-07 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/config.h (_REENT_GLOBAL_ATEXIT): Define for
RTEMS.
* libc/include/sys/reent.h (_reent): Use _REENT_GLOBAL_ATEXIT.
(_global_atexit): Declare if _REENT_GLOBAL_ATEXIT is defined.
* libc/reent/reent.c (_reclaim_reent): Remove atexit cleanup if
_REENT_GLOBAL_ATEXIT is defined.
(_wrapup_reent): Remove atexit handling if _REENT_GLOBAL_ATEXIT
is defined.
* libc/stdlib/__atexit.c (_global_atexit0): Define if
_REENT_GLOBAL_ATEXIT is defined.
* libc/stdlib/__call_atexit.c (_global_atexit): Define if
_REENT_GLOBAL_ATEXIT is defined.
Diffstat (limited to 'newlib/libc/reent/reent.c')
-rw-r--r-- | newlib/libc/reent/reent.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c index 63812db83..61da3b2ba 100644 --- a/newlib/libc/reent/reent.c +++ b/newlib/libc/reent/reent.c @@ -87,10 +87,14 @@ _DEFUN (_reclaim_reent, (ptr), _free_r (ptr, ptr->_localtime_buf); if (ptr->_asctime_buf) _free_r (ptr, ptr->_asctime_buf); +#endif + +#ifndef _REENT_GLOBAL_ATEXIT + /* atexit stuff */ +# ifdef _REENT_SMALL if (ptr->_atexit && ptr->_atexit->_on_exit_args_ptr) _free_r (ptr, ptr->_atexit->_on_exit_args_ptr); -#else - /* atexit stuff */ +# else if ((ptr->_atexit) && (ptr->_atexit != &ptr->_atexit0)) { struct _atexit *p, *q; @@ -101,6 +105,7 @@ _DEFUN (_reclaim_reent, (ptr), _free_r (ptr, q); } } +# endif #endif if (ptr->_cvtbuf) @@ -131,19 +136,23 @@ _DEFUN (_reclaim_reent, (ptr), void _DEFUN (_wrapup_reent, (ptr), struct _reent *ptr) { +#ifndef _REENT_GLOBAL_ATEXIT register struct _atexit *p; +#endif register int n; if (ptr == NULL) ptr = _REENT; -#ifdef _REENT_SMALL +#ifndef _REENT_GLOBAL_ATEXIT +# ifdef _REENT_SMALL for (p = ptr->_atexit, n = p ? p->_ind : 0; --n >= 0;) (*p->_fns[n]) (); -#else +# else for (p = ptr->_atexit; p; p = p->_next) for (n = p->_ind; --n >= 0;) (*p->_fns[n]) (); +# endif #endif if (ptr->__cleanup) (*ptr->__cleanup) (ptr); |