Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Green <mrg@redhat.com>2002-02-03 12:24:18 +0300
committerMatthew Green <mrg@redhat.com>2002-02-03 12:24:18 +0300
commit8195aff714f2ea5d680a5129a1d54af388e90355 (patch)
tree683ff47f4802385e669491dda42bf8050772dbdf /newlib/libc/reent
parentad67ada2fc7cdb361643d506701e274a67d796f9 (diff)
* 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')
-rw-r--r--newlib/libc/reent/reent.c27
-rw-r--r--newlib/libc/reent/reent.tex4
-rw-r--r--newlib/libc/reent/signgam.c2
3 files changed, 29 insertions, 4 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);
}
diff --git a/newlib/libc/reent/reent.tex b/newlib/libc/reent/reent.tex
index 71a0a0dcd..545624ca9 100644
--- a/newlib/libc/reent/reent.tex
+++ b/newlib/libc/reent/reent.tex
@@ -29,6 +29,10 @@ and @var{mode}, and uses the global reentrancy structure. The function
pointer to an instance of the reentrancy structure, @var{file}
and @var{mode}.
+There are two versions of @samp{struct _reent}, a normal one and one
+for small memory systems, controlled by the @code{_REENT_SMALL}
+definition from the (automatically included) @file{<sys/config.h>}.
+
@cindex global reentrancy structure
@findex _impure_ptr
Each function which uses the global reentrancy structure uses the global
diff --git a/newlib/libc/reent/signgam.c b/newlib/libc/reent/signgam.c
index 905386686..d3c17c9e5 100644
--- a/newlib/libc/reent/signgam.c
+++ b/newlib/libc/reent/signgam.c
@@ -10,7 +10,7 @@
int *
__signgam ()
{
- return &_REENT->_new._reent._gamma_signgam;
+ return _REENT_SIGNGAM(_REENT);
}
#endif