diff options
author | Matthew Green <mrg@redhat.com> | 2002-02-03 09:24:18 +0000 |
---|---|---|
committer | Matthew Green <mrg@redhat.com> | 2002-02-03 09:24:18 +0000 |
commit | 8195aff714f2ea5d680a5129a1d54af388e90355 (patch) | |
tree | 683ff47f4802385e669491dda42bf8050772dbdf /newlib/libc/reent/reent.c | |
parent | ad67ada2fc7cdb361643d506701e274a67d796f9 (diff) | |
download | cygnal-8195aff714f2ea5d680a5129a1d54af388e90355.tar.gz cygnal-8195aff714f2ea5d680a5129a1d54af388e90355.tar.bz2 cygnal-8195aff714f2ea5d680a5129a1d54af388e90355.zip |
* implement a new `struct _reent' that is significantly smaller. use this
if _REENT_SMALL is defined in config.h. define this for xstormy16.
Diffstat (limited to 'newlib/libc/reent/reent.c')
-rw-r--r-- | newlib/libc/reent/reent.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c index f35d95711..192796908 100644 --- a/newlib/libc/reent/reent.c +++ b/newlib/libc/reent/reent.c @@ -48,14 +48,17 @@ _reclaim_reent (ptr) if (ptr != _impure_ptr) { /* used by mprec routines. */ - if (ptr->_freelist) +#ifdef _REENT_SMALL + if (ptr->_mp) /* don't bother allocating it! */ +#endif + if (_REENT_MP_FREELIST(ptr)) { int i; for (i = 0; i < 15 /* _Kmax */; i++) { struct _Bigint *thisone, *nextone; - nextone = ptr->_freelist[i]; + nextone = _REENT_MP_FREELIST(ptr)[i]; while (nextone) { thisone = nextone; @@ -64,9 +67,21 @@ _reclaim_reent (ptr) } } - _free_r (ptr, ptr->_freelist); + _free_r (ptr, _REENT_MP_FREELIST(ptr)); } +#ifdef _REENT_SMALL + if (ptr->_emergency) + _free_r (ptr, ptr->_emergency); + if (ptr->_mp) + _free_r (ptr, ptr->_mp); + if (ptr->_r48) + _free_r (ptr, ptr->_r48); + if (ptr->_localtime_buf) + _free_r (ptr, ptr->_localtime_buf); + if (ptr->_asctime_buf) + _free_r (ptr, ptr->_asctime_buf); +#else /* atexit stuff */ if ((ptr->_atexit) && (ptr->_atexit != &ptr->_atexit0)) { @@ -78,6 +93,7 @@ _reclaim_reent (ptr) _free_r (ptr, q); } } +#endif if (ptr->_cvtbuf) _free_r (ptr, ptr->_cvtbuf); @@ -113,9 +129,14 @@ _wrapup_reent(struct _reent *ptr) if (ptr == 0) ptr = _REENT; +#ifdef _REENT_SMALL + for (p = &ptr->_atexit, n = p->_ind; --n >= 0;) + (*p->_fns[n]) (); +#else for (p = ptr->_atexit; p; p = p->_next) for (n = p->_ind; --n >= 0;) (*p->_fns[n]) (); +#endif if (ptr->__cleanup) (*ptr->__cleanup) (ptr); } |