aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/stdlib/mprec.c
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/stdlib/mprec.c')
-rw-r--r--newlib/libc/stdlib/mprec.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c
index 8a2d404..0ef28c7 100644
--- a/newlib/libc/stdlib/mprec.c
+++ b/newlib/libc/stdlib/mprec.c
@@ -95,21 +95,22 @@ _DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k)
int x;
_Bigint *rv ;
- if (ptr->_freelist == NULL)
+ _REENT_CHECK_MP(ptr);
+ if (_REENT_MP_FREELIST(ptr) == NULL)
{
/* Allocate a list of pointers to the mprec objects */
- ptr->_freelist = (struct _Bigint **) _calloc_r (ptr,
+ _REENT_MP_FREELIST(ptr) = (struct _Bigint **) _calloc_r (ptr,
sizeof (struct _Bigint *),
_Kmax + 1);
- if (ptr->_freelist == NULL)
+ if (_REENT_MP_FREELIST(ptr) == NULL)
{
return NULL;
}
}
- if ((rv = ptr->_freelist[k]) != 0)
+ if ((rv = _REENT_MP_FREELIST(ptr)[k]) != 0)
{
- ptr->_freelist[k] = rv->_next;
+ _REENT_MP_FREELIST(ptr)[k] = rv->_next;
}
else
{
@@ -130,10 +131,11 @@ _DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k)
void
_DEFUN (Bfree, (ptr, v), struct _reent *ptr _AND _Bigint * v)
{
+ _REENT_CHECK_MP(ptr);
if (v)
{
- v->_next = ptr->_freelist[v->_k];
- ptr->_freelist[v->_k] = v;
+ v->_next = _REENT_MP_FREELIST(ptr)[v->_k];
+ _REENT_MP_FREELIST(ptr)[v->_k] = v;
}
}
@@ -425,10 +427,11 @@ _DEFUN (pow5mult,
if (!(k >>= 2))
return b;
- if (!(p5 = ptr->_p5s))
+ _REENT_CHECK_MP(ptr);
+ if (!(p5 = _REENT_MP_P5S(ptr)))
{
/* first time */
- p5 = ptr->_p5s = i2b (ptr, 625);
+ p5 = _REENT_MP_P5S(ptr) = i2b (ptr, 625);
p5->_next = 0;
}
for (;;)