* implement a new `struct _reent' that is significantly smaller. use this
if _REENT_SMALL is defined in config.h. define this for xstormy16.
This commit is contained in:
parent
ad67ada2fc
commit
8195aff714
|
@ -1,3 +1,87 @@
|
||||||
|
2002-02-02 matthew green <mrg@redhat.com>
|
||||||
|
|
||||||
|
* libc/include/sys/config.h (_REENT_SMALL): Define for Xstormy16.
|
||||||
|
|
||||||
|
* libc/reent/reent.c (_reclaim_reent): Clean for _REENT_SMALL case.
|
||||||
|
* libc/reent/reent.tex: Add blurb about _REENT_SMALL.
|
||||||
|
* libc/include/sys/reent.h (struct _reent): Completely new version
|
||||||
|
for _REENT_SMALL.
|
||||||
|
(_REENT_INIT): New defines, different defintion depending on _REENT_SMALL.
|
||||||
|
(_REENT_CHECK, _REENT_CHECK_TM): Likewise.
|
||||||
|
(_REENT_CHECK_ASCTIME_BUF, _REENT_INIT_RAND48): Likewise.
|
||||||
|
(_REENT_CHECK_RAND48, _REENT_INIT_MP, _REENT_CHECK_MP): Likewise.
|
||||||
|
(_REENT_CHECK_EMERGENCY, _REENT_SIGNGAM, _REENT_RAND_NEXT): Likewise.
|
||||||
|
(_REENT_RAND48_SEED, _REENT_RAND48_MULT, _REENT_RAND48_ADD): Likewise.
|
||||||
|
(_REENT_MP_RESULT, _REENT_MP_RESULT_K, _REENT_MP_P5S): Likewise.
|
||||||
|
(_REENT_MP_FREELIST, _REENT_ASCTIME_BUF, _REENT_TM): Likewise.
|
||||||
|
(_REENT_EMERGENCY): Likewise.
|
||||||
|
|
||||||
|
* libc/include/sys/reent.h (struct __sFILE_fake): New struct, same as
|
||||||
|
the start of the real __sFILE, used for stdin, stdout and stderr until
|
||||||
|
they are setup properly.
|
||||||
|
(struct __sFILE): Move location of _data in _REENT_SMALL case.
|
||||||
|
* libc/stdio/findfp.c (__sinit): Rearrange for _REENT_SMALL case by
|
||||||
|
allocated stdin, stdout and stderr.
|
||||||
|
* libc/stdio/getchar.c (_getchar_r): Call _REENT_SMALL_CHECK_INIT().
|
||||||
|
* libc/stdio/iprintf.c (iprintf, _iprintf_r): Likewise.
|
||||||
|
* libc/stdio/perror.c (_perror_r): Likewise.
|
||||||
|
* libc/stdio/printf.c (printf, _printf_r): Likewise.
|
||||||
|
* libc/stdio/putchar.c (_putchar_r): Likewise.
|
||||||
|
* libc/stdio/puts.c (_puts_r): Likewise.
|
||||||
|
* libc/stdio/scanf.c (scanf, _scanf_r): Likewise.
|
||||||
|
* libc/stdio/vprintf.c (vprintf): Likewise.
|
||||||
|
* libc/stdio/vscanf.c (vscanf, _vscanf_r): Likewise.
|
||||||
|
|
||||||
|
* libc/stdio/tmpnam.c (_tmpnam_r): Use _REENT_EMERGENCY().
|
||||||
|
|
||||||
|
* libc/reent/reent.c (_wrapup_reent): Adjust for _REENT_SMALL atexit.
|
||||||
|
* libc/include/sys/reent.h (_atexit): Limit atexit() entries to 32
|
||||||
|
for _REENT_SMALL.
|
||||||
|
* libc/stdlib/atexit.c (atexit): Rearrange for _REENT_SMALL case.
|
||||||
|
* libc/stdlib/exit.c (exit): Rearrange for _REENT_SMALL case.
|
||||||
|
|
||||||
|
* libc/include/sys/reent.h (struct _rand48): Keep _rand_next if
|
||||||
|
_REENT_SMALL.
|
||||||
|
* libc/stdlib/drand48.c (_drand48_r): Call _REENT_CHECK_RAND48().
|
||||||
|
* libc/stdlib/lcong48.c (_lcong48_r): Likewise.
|
||||||
|
* libc/stdlib/lrand48.c (_lrand48_r): Likewise.
|
||||||
|
* libc/stdlib/mrand48.c (_mrand48_r): Likewise.
|
||||||
|
* libc/stdlib/rand48.c (__dorand48): Likewise.
|
||||||
|
* libc/stdlib/seed48.c (_seed48_r): Likewise.
|
||||||
|
* libc/stdlib/srand48.c (_srand48_r): Likewise.
|
||||||
|
* libc/stdlib/rand48.h (__rand48_seed, __rand48_mult, __rand48_add): Define
|
||||||
|
as _REENT_RAND48_SEED(), _REENT_RAND48_MULT() and _REENT_RAND48_ADD().
|
||||||
|
* libc/stdlib/dtoa.c (_dtoa_r): Call _REENT_CHECK_MP(). Use
|
||||||
|
_REENT_MP_RESULT() and _REENT_MP_RESULT_K().
|
||||||
|
* libc/stdlib/ldtoa.c (_ldtoa_r): Likewise.
|
||||||
|
* libc/stdlib/rand.c (srand): Use _REENT_RAND_NEXT().
|
||||||
|
* libc/stdlib/rand.c (rand): Likewise.
|
||||||
|
|
||||||
|
* libc/stdlib/mallocr.c (malloc_stats): Call _REENT_SMALL_CHECK_INIT().
|
||||||
|
* libc/stdlib/mstats.c (_mstats_r): Call _REENT_SMALL_CHECK_INIT().
|
||||||
|
|
||||||
|
* libc/stdlib/mprec.c (Balloc): Call _REENT_CHECK_MP. Use
|
||||||
|
_REENT_MP_FREELIST() and _REENT_MP_P5S.
|
||||||
|
* libc/include/sys/reent.h (struct _mprec): New structure.
|
||||||
|
|
||||||
|
* libc/include/sys/reent.h (struct _reent): Rename _strtok_last to
|
||||||
|
_unused_strtok_last.
|
||||||
|
* libc/string/strtok.c (strtok): Use a local static variable.
|
||||||
|
|
||||||
|
* libc/include/sys/reent.h (_REENT_ASCTIME_SIZE): New define.
|
||||||
|
(_REENT_EMERGENCY_SIZE): Likewise.
|
||||||
|
* libc/time/asctime.c (asctime): Call _REENT_CHECK_ASCTIME_BUF(). Use
|
||||||
|
_REENT_ASCTIME_BUF().
|
||||||
|
* libc/time/lcltime.c (localtime): Call _REENT_CHECK_TM(). Use
|
||||||
|
_REENT_TM().
|
||||||
|
|
||||||
|
* libc/include/math.h (__singam_r): Use _REENT_SIGNGAM().
|
||||||
|
* libc/reent/signgam.c (__signgam): Use _REENT_SIGNGAM().
|
||||||
|
* libm/math/w_gamma.c (gamma): Use _REENT_SIGNGAM().
|
||||||
|
* libm/math/w_lgamma.c (lgamma): Use _REENT_SIGNGAM().
|
||||||
|
* libm/math/wf_gamma.c (gammaf): Use _REENT_SIGNGAM().
|
||||||
|
* libm/math/wf_lgamma.c (lgammaf): Use _REENT_SIGNGAM().
|
||||||
|
|
||||||
2002-02-01 Geoffrey Keating <geoffk@redhat.com>
|
2002-02-01 Geoffrey Keating <geoffk@redhat.com>
|
||||||
|
|
||||||
* configure.host (xstormy16): Don't use the generic malloc.
|
* configure.host (xstormy16): Don't use the generic malloc.
|
||||||
|
|
|
@ -198,7 +198,7 @@ extern float dremf _PARAMS((float, float));
|
||||||
extern int *__signgam _PARAMS((void));
|
extern int *__signgam _PARAMS((void));
|
||||||
#endif /* ! defined (_REENT_ONLY) */
|
#endif /* ! defined (_REENT_ONLY) */
|
||||||
|
|
||||||
#define __signgam_r(ptr) ((ptr)->_new._reent._gamma_signgam)
|
#define __signgam_r(ptr) _REENT_SIGNGAM(ptr)
|
||||||
|
|
||||||
/* The exception structure passed to the matherr routine. */
|
/* The exception structure passed to the matherr routine. */
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@
|
||||||
#define MALLOC_ALIGNMENT 8
|
#define MALLOC_ALIGNMENT 8
|
||||||
#define _POINTER_INT short
|
#define _POINTER_INT short
|
||||||
#define __BUFSIZ__ 16
|
#define __BUFSIZ__ 16
|
||||||
|
#define _REENT_SMALL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if INT_MAX == 32767
|
#if INT_MAX == 32767
|
||||||
|
|
|
@ -28,6 +28,11 @@ typedef unsigned __Long __ULong;
|
||||||
typedef __uint32_t __ULong;
|
typedef __uint32_t __ULong;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If _REENT_SMALL is defined, we make struct _reent as small as possible,
|
||||||
|
* by having nearly everything possible allocated at first use.
|
||||||
|
*/
|
||||||
|
|
||||||
struct _glue
|
struct _glue
|
||||||
{
|
{
|
||||||
struct _glue *_next;
|
struct _glue *_next;
|
||||||
|
@ -57,16 +62,23 @@ struct __tm
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* atexit() support
|
* atexit() support. For _REENT_SMALL, we limit to 32 max.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
|
#define _ATEXIT_SIZE 32 /* must be at least 32 to guarantee ANSI conformance */
|
||||||
|
|
||||||
|
#ifndef _REENT_SMALL
|
||||||
struct _atexit {
|
struct _atexit {
|
||||||
struct _atexit *_next; /* next in list */
|
struct _atexit *_next; /* next in list */
|
||||||
int _ind; /* next index in this table */
|
int _ind; /* next index in this table */
|
||||||
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
|
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
|
||||||
};
|
};
|
||||||
|
#else
|
||||||
|
struct _atexit {
|
||||||
|
int _ind; /* next index in this table */
|
||||||
|
void (*_fns[_ATEXIT_SIZE])(void); /* the table itself */
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Stdio buffers.
|
* Stdio buffers.
|
||||||
|
@ -113,6 +125,29 @@ typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
|
||||||
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
|
* _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _REENT_SMALL
|
||||||
|
/*
|
||||||
|
* struct __sFILE_fake is the start of a struct __sFILE, with only the
|
||||||
|
* minimal fields allocated. In __sinit() we really allocate the 3
|
||||||
|
* standard streams, etc., and point away from this fake.
|
||||||
|
*/
|
||||||
|
struct __sFILE_fake {
|
||||||
|
unsigned char *_p; /* current position in (some) buffer */
|
||||||
|
int _r; /* read space left for getc() */
|
||||||
|
int _w; /* write space left for putc() */
|
||||||
|
short _flags; /* flags, below; this FILE is free if 0 */
|
||||||
|
short _file; /* fileno, if Unix descriptor, else -1 */
|
||||||
|
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
|
||||||
|
int _lbfsize; /* 0 or -_bf._size, for inline putc */
|
||||||
|
|
||||||
|
struct _reent *_data;
|
||||||
|
};
|
||||||
|
/* CHECK_INIT() comes from stdio/local.h; be sure to include that. */
|
||||||
|
# define _REENT_SMALL_CHECK_INIT(fp) CHECK_INIT(fp)
|
||||||
|
#else
|
||||||
|
# define _REENT_SMALL_CHECK_INIT(fp) /* nothing */
|
||||||
|
#endif
|
||||||
|
|
||||||
struct __sFILE {
|
struct __sFILE {
|
||||||
unsigned char *_p; /* current position in (some) buffer */
|
unsigned char *_p; /* current position in (some) buffer */
|
||||||
int _r; /* read space left for getc() */
|
int _r; /* read space left for getc() */
|
||||||
|
@ -122,6 +157,10 @@ struct __sFILE {
|
||||||
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
|
struct __sbuf _bf; /* the buffer (at least 1 byte, if !NULL) */
|
||||||
int _lbfsize; /* 0 or -_bf._size, for inline putc */
|
int _lbfsize; /* 0 or -_bf._size, for inline putc */
|
||||||
|
|
||||||
|
#ifdef _REENT_SMALL
|
||||||
|
struct _reent *_data;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* operations */
|
/* operations */
|
||||||
_PTR _cookie; /* cookie passed to io functions */
|
_PTR _cookie; /* cookie passed to io functions */
|
||||||
|
|
||||||
|
@ -147,7 +186,9 @@ struct __sFILE {
|
||||||
int _blksize; /* stat.st_blksize (may be != _bf._size) */
|
int _blksize; /* stat.st_blksize (may be != _bf._size) */
|
||||||
int _offset; /* current lseek offset */
|
int _offset; /* current lseek offset */
|
||||||
|
|
||||||
struct _reent *_data;
|
#ifndef _REENT_SMALL
|
||||||
|
struct _reent *_data; /* Here for binary compatibility? Remove? */
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -175,8 +216,16 @@ struct _rand48 {
|
||||||
unsigned short _seed[3];
|
unsigned short _seed[3];
|
||||||
unsigned short _mult[3];
|
unsigned short _mult[3];
|
||||||
unsigned short _add;
|
unsigned short _add;
|
||||||
|
#ifdef _REENT_SMALL
|
||||||
|
/* Put this in here as well, for good luck. */
|
||||||
|
__extension__ unsigned long long _rand_next;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* How big the some arrays are. */
|
||||||
|
#define _REENT_EMERGENCY_SIZE 25
|
||||||
|
#define _REENT_ASCTIME_SIZE 26
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* struct _reent
|
* struct _reent
|
||||||
*
|
*
|
||||||
|
@ -185,10 +234,137 @@ struct _rand48 {
|
||||||
* reentrant. IE: All state information is contained here.
|
* reentrant. IE: All state information is contained here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef _REENT_SMALL
|
||||||
|
|
||||||
|
struct _mprec
|
||||||
|
{
|
||||||
|
/* used by mprec routines */
|
||||||
|
struct _Bigint *_result;
|
||||||
|
int _result_k;
|
||||||
|
struct _Bigint *_p5s;
|
||||||
|
struct _Bigint **_freelist;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* This version of _reent is layed our with "int"s in pairs, to help
|
||||||
|
* ports with 16-bit int's but 32-bit pointers, align nicely. */
|
||||||
struct _reent
|
struct _reent
|
||||||
{
|
{
|
||||||
/* local copy of errno */
|
|
||||||
int _errno;
|
/* FILE is a big struct and may change over time. To try to achieve binary
|
||||||
|
compatibility with future versions, put stdin,stdout,stderr here.
|
||||||
|
These are pointers into member __sf defined below. */
|
||||||
|
struct __sFILE *_stdin, *_stdout, *_stderr; /* XXX */
|
||||||
|
|
||||||
|
int _errno; /* local copy of errno */
|
||||||
|
|
||||||
|
int _inc; /* used by tmpnam */
|
||||||
|
|
||||||
|
char *_emergency;
|
||||||
|
|
||||||
|
int __sdidinit; /* 1 means stdio has been init'd */
|
||||||
|
|
||||||
|
int _current_category; /* used by setlocale */
|
||||||
|
_CONST char *_current_locale;
|
||||||
|
|
||||||
|
struct _mprec *_mp;
|
||||||
|
|
||||||
|
void _EXFUN((*__cleanup),(struct _reent *));
|
||||||
|
|
||||||
|
int _gamma_signgam;
|
||||||
|
|
||||||
|
/* used by some fp conversion routines */
|
||||||
|
int _cvtlen; /* should be size_t */
|
||||||
|
char *_cvtbuf;
|
||||||
|
|
||||||
|
struct _rand48 *_r48;
|
||||||
|
struct __tm *_localtime_buf;
|
||||||
|
char *_asctime_buf;
|
||||||
|
|
||||||
|
/* signal info */
|
||||||
|
void (**(_sig_func))(int);
|
||||||
|
|
||||||
|
/* atexit stuff */
|
||||||
|
struct _atexit _atexit;
|
||||||
|
|
||||||
|
struct _glue __sglue; /* root of glue chain */
|
||||||
|
struct __sFILE *__sf; /* file descriptors */
|
||||||
|
struct __sFILE_fake __sf_fake; /* fake initial stdin/out/err */
|
||||||
|
};
|
||||||
|
|
||||||
|
#define _REENT_INIT(var) \
|
||||||
|
{ &var.__sf_fake, &var.__sf_fake, &var.__sf_fake, 0, 0, _NULL, 0, 0, \
|
||||||
|
"C", _NULL, _NULL, 0, 0, _NULL, _NULL, _NULL, _NULL, _NULL, \
|
||||||
|
{ 0, _NULL }, { _NULL, 0, _NULL }, 0 }
|
||||||
|
|
||||||
|
/* Only built the assert() calls if we are built with debugging. */
|
||||||
|
#if DEBUG
|
||||||
|
#include <assert.h>
|
||||||
|
#else
|
||||||
|
#define assert(x) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Generic _REENT check macro. */
|
||||||
|
#define _REENT_CHECK(var, what, type, size, init) do { \
|
||||||
|
struct _reent *_r = (var); \
|
||||||
|
if (_r->what == NULL) { \
|
||||||
|
_r->what = (type)malloc(size); \
|
||||||
|
assert(_r->what); \
|
||||||
|
init; \
|
||||||
|
} \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
|
#define _REENT_CHECK_TM(var) \
|
||||||
|
_REENT_CHECK(var, _localtime_buf, struct __tm *, sizeof *((var)->_localtime_buf), \
|
||||||
|
/* nothing */)
|
||||||
|
|
||||||
|
#define _REENT_CHECK_ASCTIME_BUF(var) \
|
||||||
|
_REENT_CHECK(var, _asctime_buf, char *, _REENT_ASCTIME_SIZE, \
|
||||||
|
memset((var)->_asctime_buf, 0, _REENT_ASCTIME_SIZE))
|
||||||
|
|
||||||
|
/* Handle the dynamically allocated rand48 structure. */
|
||||||
|
#define _REENT_INIT_RAND48(var) do { \
|
||||||
|
struct _reent *_r = (var); \
|
||||||
|
_r->_r48->_seed[0] = _RAND48_SEED_0; \
|
||||||
|
_r->_r48->_seed[1] = _RAND48_SEED_1; \
|
||||||
|
_r->_r48->_seed[2] = _RAND48_SEED_2; \
|
||||||
|
_r->_r48->_mult[0] = _RAND48_MULT_0; \
|
||||||
|
_r->_r48->_mult[1] = _RAND48_MULT_1; \
|
||||||
|
_r->_r48->_mult[2] = _RAND48_MULT_2; \
|
||||||
|
_r->_r48->_add = _RAND48_ADD; \
|
||||||
|
} while (0)
|
||||||
|
#define _REENT_CHECK_RAND48(var) \
|
||||||
|
_REENT_CHECK(var, _r48, struct _rand48 *, sizeof *((var)->_r48), _REENT_INIT_RAND48((var)))
|
||||||
|
|
||||||
|
#define _REENT_INIT_MP(var) do { \
|
||||||
|
struct _reent *_r = (var); \
|
||||||
|
_r->_mp->_result_k = 0; \
|
||||||
|
_r->_mp->_result = _r->_mp->_p5s = _NULL; \
|
||||||
|
_r->_mp->_freelist = _NULL; \
|
||||||
|
} while (0)
|
||||||
|
#define _REENT_CHECK_MP(var) \
|
||||||
|
_REENT_CHECK(var, _mp, struct _mprec *, sizeof *((var)->_mp), _REENT_INIT_MP(var))
|
||||||
|
|
||||||
|
#define _REENT_CHECK_EMERGENCY(var) \
|
||||||
|
_REENT_CHECK(var, _emergency, char *, sizeof *((var)->_emergency), /* nothing */)
|
||||||
|
|
||||||
|
#define _REENT_SIGNGAM(ptr) ((ptr)->_gamma_signgam)
|
||||||
|
#define _REENT_RAND_NEXT(ptr) ((ptr)->_r48->_rand_next)
|
||||||
|
#define _REENT_RAND48_SEED(ptr) ((ptr)->_r48->_seed)
|
||||||
|
#define _REENT_RAND48_MULT(ptr) ((ptr)->_r48->_mult)
|
||||||
|
#define _REENT_RAND48_ADD(ptr) ((ptr)->_r48->_add)
|
||||||
|
#define _REENT_MP_RESULT(ptr) ((ptr)->_mp->_result)
|
||||||
|
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_mp->_result_k)
|
||||||
|
#define _REENT_MP_P5S(ptr) ((ptr)->_mp->_p5s)
|
||||||
|
#define _REENT_MP_FREELIST(ptr) ((ptr)->_mp->_freelist)
|
||||||
|
#define _REENT_ASCTIME_BUF(ptr) ((ptr)->_asctime_buf)
|
||||||
|
#define _REENT_TM(ptr) ((ptr)->_localtime_buf)
|
||||||
|
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
|
||||||
|
|
||||||
|
#else /* !_REENT_SMALL */
|
||||||
|
|
||||||
|
struct _reent
|
||||||
|
{
|
||||||
|
int _errno; /* local copy of errno */
|
||||||
|
|
||||||
/* FILE is a big struct and may change over time. To try to achieve binary
|
/* FILE is a big struct and may change over time. To try to achieve binary
|
||||||
compatibility with future versions, put stdin,stdout,stderr here.
|
compatibility with future versions, put stdin,stdout,stderr here.
|
||||||
|
@ -196,7 +372,7 @@ struct _reent
|
||||||
struct __sFILE *_stdin, *_stdout, *_stderr;
|
struct __sFILE *_stdin, *_stdout, *_stderr;
|
||||||
|
|
||||||
int _inc; /* used by tmpnam */
|
int _inc; /* used by tmpnam */
|
||||||
char _emergency[25];
|
char _emergency[_REENT_EMERGENCY_SIZE];
|
||||||
|
|
||||||
int _current_category; /* used by setlocale */
|
int _current_category; /* used by setlocale */
|
||||||
_CONST char *_current_locale;
|
_CONST char *_current_locale;
|
||||||
|
@ -220,7 +396,7 @@ struct _reent
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
unsigned int _unused_rand;
|
unsigned int _unused_rand;
|
||||||
char * _strtok_last;
|
char * _unused_strtok_last;
|
||||||
char _asctime_buf[26];
|
char _asctime_buf[26];
|
||||||
struct __tm _localtime_buf;
|
struct __tm _localtime_buf;
|
||||||
int _gamma_signgam;
|
int _gamma_signgam;
|
||||||
|
@ -252,8 +428,6 @@ struct _reent
|
||||||
struct __sFILE __sf[3]; /* first three file descriptors */
|
struct __sFILE __sf[3]; /* first three file descriptors */
|
||||||
};
|
};
|
||||||
|
|
||||||
#define _NULL 0
|
|
||||||
|
|
||||||
#define _REENT_INIT(var) \
|
#define _REENT_INIT(var) \
|
||||||
{ 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \
|
{ 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \
|
||||||
0, _NULL, _NULL, 0, _NULL, _NULL, 0, _NULL, { {0, _NULL, "", \
|
0, _NULL, _NULL, 0, _NULL, _NULL, 0, _NULL, { {0, _NULL, "", \
|
||||||
|
@ -261,6 +435,28 @@ struct _reent
|
||||||
{{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
|
{{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
|
||||||
{_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, _RAND48_ADD}} } }
|
{_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, _RAND48_ADD}} } }
|
||||||
|
|
||||||
|
#define _REENT_CHECK_RAND48(ptr) /* nothing */
|
||||||
|
#define _REENT_CHECK_MP(ptr) /* nothing */
|
||||||
|
#define _REENT_CHECK_TM(ptr) /* nothing */
|
||||||
|
#define _REENT_CHECK_ASCTIME_BUF(ptr) /* nothing */
|
||||||
|
|
||||||
|
#define _REENT_SIGNGAM(ptr) ((ptr)->_new._reent._gamma_signgam)
|
||||||
|
#define _REENT_RAND_NEXT(ptr) ((ptr)->_new._reent._rand_next)
|
||||||
|
#define _REENT_RAND48_SEED(ptr) ((ptr)->_new._reent._r48._seed)
|
||||||
|
#define _REENT_RAND48_MULT(ptr) ((ptr)->_new._reent._r48._mult)
|
||||||
|
#define _REENT_RAND48_ADD(ptr) ((ptr)->_new._reent._r48._add)
|
||||||
|
#define _REENT_MP_RESULT(ptr) ((ptr)->_result)
|
||||||
|
#define _REENT_MP_RESULT_K(ptr) ((ptr)->_result_k)
|
||||||
|
#define _REENT_MP_P5S(ptr) ((ptr)->_p5s)
|
||||||
|
#define _REENT_MP_FREELIST(ptr) ((ptr)->_freelist)
|
||||||
|
#define _REENT_ASCTIME_BUF(ptr) (&(ptr)->_new._reent._asctime_buf)
|
||||||
|
#define _REENT_TM(ptr) (&(ptr)->_new._reent._localtime_buf)
|
||||||
|
#define _REENT_EMERGENCY(ptr) ((ptr)->_emergency)
|
||||||
|
|
||||||
|
#endif /* !_REENT_SMALL */
|
||||||
|
|
||||||
|
#define _NULL 0
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All references to struct _reent are via this pointer.
|
* All references to struct _reent are via this pointer.
|
||||||
* Internally, newlib routines that need to reference it should use _REENT.
|
* Internally, newlib routines that need to reference it should use _REENT.
|
||||||
|
|
|
@ -48,14 +48,17 @@ _reclaim_reent (ptr)
|
||||||
if (ptr != _impure_ptr)
|
if (ptr != _impure_ptr)
|
||||||
{
|
{
|
||||||
/* used by mprec routines. */
|
/* 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;
|
int i;
|
||||||
for (i = 0; i < 15 /* _Kmax */; i++)
|
for (i = 0; i < 15 /* _Kmax */; i++)
|
||||||
{
|
{
|
||||||
struct _Bigint *thisone, *nextone;
|
struct _Bigint *thisone, *nextone;
|
||||||
|
|
||||||
nextone = ptr->_freelist[i];
|
nextone = _REENT_MP_FREELIST(ptr)[i];
|
||||||
while (nextone)
|
while (nextone)
|
||||||
{
|
{
|
||||||
thisone = 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 */
|
/* atexit stuff */
|
||||||
if ((ptr->_atexit) && (ptr->_atexit != &ptr->_atexit0))
|
if ((ptr->_atexit) && (ptr->_atexit != &ptr->_atexit0))
|
||||||
{
|
{
|
||||||
|
@ -78,6 +93,7 @@ _reclaim_reent (ptr)
|
||||||
_free_r (ptr, q);
|
_free_r (ptr, q);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ptr->_cvtbuf)
|
if (ptr->_cvtbuf)
|
||||||
_free_r (ptr, ptr->_cvtbuf);
|
_free_r (ptr, ptr->_cvtbuf);
|
||||||
|
@ -113,9 +129,14 @@ _wrapup_reent(struct _reent *ptr)
|
||||||
if (ptr == 0)
|
if (ptr == 0)
|
||||||
ptr = _REENT;
|
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 (p = ptr->_atexit; p; p = p->_next)
|
||||||
for (n = p->_ind; --n >= 0;)
|
for (n = p->_ind; --n >= 0;)
|
||||||
(*p->_fns[n]) ();
|
(*p->_fns[n]) ();
|
||||||
|
#endif
|
||||||
if (ptr->__cleanup)
|
if (ptr->__cleanup)
|
||||||
(*ptr->__cleanup) (ptr);
|
(*ptr->__cleanup) (ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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}
|
pointer to an instance of the reentrancy structure, @var{file}
|
||||||
and @var{mode}.
|
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
|
@cindex global reentrancy structure
|
||||||
@findex _impure_ptr
|
@findex _impure_ptr
|
||||||
Each function which uses the global reentrancy structure uses the global
|
Each function which uses the global reentrancy structure uses the global
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
int *
|
int *
|
||||||
__signgam ()
|
__signgam ()
|
||||||
{
|
{
|
||||||
return &_REENT->_new._reent._gamma_signgam;
|
return _REENT_SIGNGAM(_REENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -151,20 +151,29 @@ __sinit (s)
|
||||||
s->__cleanup = _cleanup_r; /* conservative */
|
s->__cleanup = _cleanup_r; /* conservative */
|
||||||
s->__sdidinit = 1;
|
s->__sdidinit = 1;
|
||||||
|
|
||||||
std (s->__sf + 0, __SRD, 0, s);
|
s->__sglue._next = NULL;
|
||||||
|
#ifndef _REENT_SMALL
|
||||||
|
s->__sglue._niobs = 3;
|
||||||
|
s->__sglue._iobs = &s->__sf[0];
|
||||||
|
#else
|
||||||
|
s->__sglue._niobs = 0;
|
||||||
|
s->__sglue._iobs = NULL;
|
||||||
|
s->_stdin = __sfp(s);
|
||||||
|
s->_stdout = __sfp(s);
|
||||||
|
s->_stderr = __sfp(s);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
std (s->_stdin, __SRD, 0, s);
|
||||||
|
|
||||||
/* on platforms that have true file system I/O, we can verify whether stdout
|
/* on platforms that have true file system I/O, we can verify whether stdout
|
||||||
is an interactive terminal or not. For all other platforms, we will
|
is an interactive terminal or not. For all other platforms, we will
|
||||||
default to line buffered mode here. */
|
default to line buffered mode here. */
|
||||||
#ifdef HAVE_FCNTL
|
#ifdef HAVE_FCNTL
|
||||||
std (s->__sf + 1, __SWR, 1, s);
|
std (s->_stdout, __SWR, 1, s);
|
||||||
#else
|
#else
|
||||||
std (s->__sf + 1, __SWR | __SLBF, 1, s);
|
std (s->_stdout, __SWR | __SLBF, 1, s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std (s->__sf + 2, __SWR | __SNBF, 2, s);
|
std (s->_stderr, __SWR | __SNBF, 2, s);
|
||||||
|
|
||||||
s->__sglue._next = NULL;
|
|
||||||
s->__sglue._niobs = 3;
|
|
||||||
s->__sglue._iobs = &s->__sf[0];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,12 +74,15 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <reent.h>
|
#include <reent.h>
|
||||||
|
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
#undef getchar
|
#undef getchar
|
||||||
|
|
||||||
int
|
int
|
||||||
_getchar_r (f)
|
_getchar_r (f)
|
||||||
struct _reent *f;
|
struct _reent *f;
|
||||||
{
|
{
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdin_r (f));
|
||||||
return getc (_stdin_r (f));
|
return getc (_stdin_r (f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||||
#include <_ansi.h>
|
#include <_ansi.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
#ifndef _REENT_ONLY
|
#ifndef _REENT_ONLY
|
||||||
|
|
||||||
#ifdef _HAVE_STDC
|
#ifdef _HAVE_STDC
|
||||||
|
@ -50,6 +52,7 @@ iprintf (const char *fmt,...)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
_stdout_r (_REENT)->_data = _REENT;
|
_stdout_r (_REENT)->_data = _REENT;
|
||||||
ret = vfiprintf (stdout, fmt, ap);
|
ret = vfiprintf (stdout, fmt, ap);
|
||||||
|
@ -69,6 +72,7 @@ iprintf (fmt, va_alist)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
|
||||||
va_start (ap);
|
va_start (ap);
|
||||||
_stdout_r (_REENT)->_data = _REENT;
|
_stdout_r (_REENT)->_data = _REENT;
|
||||||
ret = vfiprintf (stdout, fmt, ap);
|
ret = vfiprintf (stdout, fmt, ap);
|
||||||
|
@ -89,6 +93,7 @@ _iprintf_r (struct _reent *ptr, const char *fmt, ...)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
ret = vfiprintf (_stdout_r (ptr), fmt, ap);
|
ret = vfiprintf (_stdout_r (ptr), fmt, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
@ -109,6 +114,7 @@ _iprintf_r (data, fmt, va_alist)
|
||||||
struct _reent *ptr = data;
|
struct _reent *ptr = data;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
va_start (ap);
|
va_start (ap);
|
||||||
ret = vfiprintf (_stdout_r (ptr), fmt, ap);
|
ret = vfiprintf (_stdout_r (ptr), fmt, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
|
@ -49,6 +49,8 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
_DEFUN (_perror_r, (ptr, s),
|
_DEFUN (_perror_r, (ptr, s),
|
||||||
struct _reent *ptr _AND
|
struct _reent *ptr _AND
|
||||||
|
@ -56,6 +58,7 @@ _DEFUN (_perror_r, (ptr, s),
|
||||||
{
|
{
|
||||||
char *error;
|
char *error;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stderr_r (ptr));
|
||||||
if (s != NULL && *s != '\0')
|
if (s != NULL && *s != '\0')
|
||||||
{
|
{
|
||||||
fputs (s, _stderr_r (ptr));
|
fputs (s, _stderr_r (ptr));
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#include <_ansi.h>
|
#include <_ansi.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
#ifdef _HAVE_STDC
|
#ifdef _HAVE_STDC
|
||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
@ -12,6 +14,7 @@ _printf_r (struct _reent *ptr, const char *fmt, ...)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
@ -31,6 +34,7 @@ _printf_r (ptr, fmt, va_alist)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
va_start (ap);
|
va_start (ap);
|
||||||
ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
ret = _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
@ -52,6 +56,7 @@ printf (const char *fmt, ...)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
_stdout_r (_REENT)->_data = _REENT;
|
_stdout_r (_REENT)->_data = _REENT;
|
||||||
ret = vfprintf (_stdout_r (_REENT), fmt, ap);
|
ret = vfprintf (_stdout_r (_REENT), fmt, ap);
|
||||||
|
@ -71,6 +76,7 @@ printf (fmt, va_alist)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
|
||||||
va_start (ap);
|
va_start (ap);
|
||||||
_stdout_r (_REENT)->_data = _REENT;
|
_stdout_r (_REENT)->_data = _REENT;
|
||||||
ret = vfprintf (_stdout_r (_REENT), fmt, ap);
|
ret = vfprintf (_stdout_r (_REENT), fmt, ap);
|
||||||
|
|
|
@ -70,6 +70,8 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
#undef putchar
|
#undef putchar
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -77,6 +79,7 @@ _putchar_r (ptr, c)
|
||||||
struct _reent *ptr;
|
struct _reent *ptr;
|
||||||
int c;
|
int c;
|
||||||
{
|
{
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
return __sputc (c, _stdout_r (ptr));
|
return __sputc (c, _stdout_r (ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,9 @@ static char sccsid[] = "%W% (Berkeley) %G%";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "fvwrite.h"
|
#include "fvwrite.h"
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the given string to stdout, appending a newline.
|
* Write the given string to stdout, appending a newline.
|
||||||
|
@ -86,6 +88,7 @@ _DEFUN (_puts_r, (ptr, s),
|
||||||
uio.uio_iov = &iov[0];
|
uio.uio_iov = &iov[0];
|
||||||
uio.uio_iovcnt = 2;
|
uio.uio_iovcnt = 2;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
return (__sfvwrite (_stdout_r (ptr), &uio) ? EOF : '\n');
|
return (__sfvwrite (_stdout_r (ptr), &uio) ? EOF : '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,7 @@ scanf (fmt, va_alist)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdin_r (_REENT));
|
||||||
#ifdef _HAVE_STDC
|
#ifdef _HAVE_STDC
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
#else
|
#else
|
||||||
|
@ -66,6 +67,7 @@ _scanf_r (ptr, fmt, va_alist)
|
||||||
int ret;
|
int ret;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdin_r (ptr));
|
||||||
#ifdef _HAVE_STDC
|
#ifdef _HAVE_STDC
|
||||||
va_start (ap, fmt);
|
va_start (ap, fmt);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -146,7 +146,8 @@ _DEFUN (_tmpnam_r, (p, s),
|
||||||
if (s == NULL)
|
if (s == NULL)
|
||||||
{
|
{
|
||||||
/* ANSI states we must use an internal static buffer if s is NULL */
|
/* ANSI states we must use an internal static buffer if s is NULL */
|
||||||
result = p->_emergency;
|
_REENT_CHECK_EMERGENCY(p);
|
||||||
|
result = _REENT_EMERGENCY(p);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,12 +26,15 @@
|
||||||
#include <varargs.h>
|
#include <varargs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "local.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
_DEFUN (vprintf, (fmt, ap),
|
_DEFUN (vprintf, (fmt, ap),
|
||||||
_CONST char *fmt _AND
|
_CONST char *fmt _AND
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
return vfprintf (stdout, fmt, ap);
|
_REENT_SMALL_CHECK_INIT(_stdout_r (_REENT));
|
||||||
|
return vfprintf (_stdout_r (_REENT), fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -40,5 +43,6 @@ _DEFUN (_vprintf_r, (ptr, fmt, ap),
|
||||||
_CONST char *fmt _AND
|
_CONST char *fmt _AND
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdout_r (ptr));
|
||||||
return _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
return _vfprintf_r (ptr, _stdout_r (ptr), fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ _DEFUN (vscanf, (fmt, ap),
|
||||||
_CONST char *fmt _AND
|
_CONST char *fmt _AND
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdin_r (_REENT));
|
||||||
return __svfscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
|
return __svfscanf_r (_REENT, _stdin_r (_REENT), fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ _DEFUN (_vscanf_r, (ptr, fmt, ap),
|
||||||
_CONST char *fmt _AND
|
_CONST char *fmt _AND
|
||||||
va_list ap)
|
va_list ap)
|
||||||
{
|
{
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stdin_r (ptr));
|
||||||
return __svfscanf_r (ptr, _stdin_r (ptr), fmt, ap);
|
return __svfscanf_r (ptr, _stdin_r (ptr), fmt, ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,6 +65,8 @@ _DEFUN (atexit,
|
||||||
{
|
{
|
||||||
register struct _atexit *p;
|
register struct _atexit *p;
|
||||||
|
|
||||||
|
/* _REENT_SMALL atexit() doesn't allow more than the required 32 entries. */
|
||||||
|
#ifndef _REENT_SMALL
|
||||||
if ((p = _REENT->_atexit) == NULL)
|
if ((p = _REENT->_atexit) == NULL)
|
||||||
_REENT->_atexit = p = &_REENT->_atexit0;
|
_REENT->_atexit = p = &_REENT->_atexit0;
|
||||||
if (p->_ind >= _ATEXIT_SIZE)
|
if (p->_ind >= _ATEXIT_SIZE)
|
||||||
|
@ -75,6 +77,11 @@ _DEFUN (atexit,
|
||||||
p->_next = _REENT->_atexit;
|
p->_next = _REENT->_atexit;
|
||||||
_REENT->_atexit = p;
|
_REENT->_atexit = p;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
p = &_REENT->_atexit;
|
||||||
|
if (p->_ind >= _ATEXIT_SIZE)
|
||||||
|
return -1;
|
||||||
|
#endif
|
||||||
p->_fns[p->_ind++] = fn;
|
p->_fns[p->_ind++] = fn;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ double
|
||||||
_DEFUN (_drand48_r, (r),
|
_DEFUN (_drand48_r, (r),
|
||||||
struct _reent *r)
|
struct _reent *r)
|
||||||
{
|
{
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
return _erand48_r(r, __rand48_seed);
|
return _erand48_r(r, __rand48_seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,12 +235,13 @@ _DEFUN (_dtoa_r,
|
||||||
|
|
||||||
d.d = _d;
|
d.d = _d;
|
||||||
|
|
||||||
if (ptr->_result)
|
_REENT_CHECK_MP(ptr);
|
||||||
|
if (_REENT_MP_RESULT(ptr))
|
||||||
{
|
{
|
||||||
ptr->_result->_k = ptr->_result_k;
|
_REENT_MP_RESULT(ptr)->_k = _REENT_MP_RESULT_K(ptr);
|
||||||
ptr->_result->_maxwds = 1 << ptr->_result_k;
|
_REENT_MP_RESULT(ptr)->_maxwds = 1 << _REENT_MP_RESULT_K(ptr);
|
||||||
Bfree (ptr, ptr->_result);
|
Bfree (ptr, _REENT_MP_RESULT(ptr));
|
||||||
ptr->_result = 0;
|
_REENT_MP_RESULT(ptr) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (word0 (d) & Sign_bit)
|
if (word0 (d) & Sign_bit)
|
||||||
|
@ -415,11 +416,11 @@ _DEFUN (_dtoa_r,
|
||||||
i = 1;
|
i = 1;
|
||||||
}
|
}
|
||||||
j = sizeof (__ULong);
|
j = sizeof (__ULong);
|
||||||
for (ptr->_result_k = 0; sizeof (_Bigint) - sizeof (__ULong) + j <= i;
|
for (_REENT_MP_RESULT_K(ptr) = 0; sizeof (_Bigint) - sizeof (__ULong) + j <= i;
|
||||||
j <<= 1)
|
j <<= 1)
|
||||||
ptr->_result_k++;
|
_REENT_MP_RESULT_K(ptr)++;
|
||||||
ptr->_result = Balloc (ptr, ptr->_result_k);
|
_REENT_MP_RESULT(ptr) = Balloc (ptr, _REENT_MP_RESULT_K(ptr));
|
||||||
s = s0 = (char *) ptr->_result;
|
s = s0 = (char *) _REENT_MP_RESULT(ptr);
|
||||||
|
|
||||||
if (ilim >= 0 && ilim <= Quick_max && try_quick)
|
if (ilim >= 0 && ilim <= Quick_max && try_quick)
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,9 +62,14 @@ _DEFUN (exit, (code),
|
||||||
register struct _atexit *p;
|
register struct _atexit *p;
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
|
#ifdef _REENT_SMALL
|
||||||
|
for (p = &_REENT->_atexit, n = p->_ind; --n >= 0;)
|
||||||
|
(*p->_fns[n]) ();
|
||||||
|
#else
|
||||||
for (p = _REENT->_atexit; p; p = p->_next)
|
for (p = _REENT->_atexit; p; p = p->_next)
|
||||||
for (n = p->_ind; --n >= 0;)
|
for (n = p->_ind; --n >= 0;)
|
||||||
(*p->_fns[n]) ();
|
(*p->_fns[n]) ();
|
||||||
|
#endif
|
||||||
if (_REENT->__cleanup)
|
if (_REENT->__cleanup)
|
||||||
(*_REENT->__cleanup) (_REENT);
|
(*_REENT->__cleanup) (_REENT);
|
||||||
_exit (code);
|
_exit (code);
|
||||||
|
|
|
@ -18,6 +18,7 @@ _DEFUN (_lcong48_r, (r, p),
|
||||||
struct _reent *r _AND
|
struct _reent *r _AND
|
||||||
unsigned short p[7])
|
unsigned short p[7])
|
||||||
{
|
{
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
__rand48_seed[0] = p[0];
|
__rand48_seed[0] = p[0];
|
||||||
__rand48_seed[1] = p[1];
|
__rand48_seed[1] = p[1];
|
||||||
__rand48_seed[2] = p[2];
|
__rand48_seed[2] = p[2];
|
||||||
|
|
|
@ -2711,13 +2711,15 @@ char *outstr;
|
||||||
rnd.rlast = -1;
|
rnd.rlast = -1;
|
||||||
rnd.rndprc = NBITS;
|
rnd.rndprc = NBITS;
|
||||||
|
|
||||||
|
_REENT_CHECK_MP(ptr);
|
||||||
|
|
||||||
/* reentrancy addition to use mprec storage pool */
|
/* reentrancy addition to use mprec storage pool */
|
||||||
if (ptr->_result)
|
if (_REENT_MP_RESULT(ptr))
|
||||||
{
|
{
|
||||||
ptr->_result->_k = ptr->_result_k;
|
_REENT_MP_RESULT(ptr)->_k = _REENT_MP_RESULT_K(ptr);
|
||||||
ptr->_result->_maxwds = 1 << ptr->_result_k;
|
_REENT_MP_RESULT(ptr)->_maxwds = 1 << _REENT_MP_RESULT_K(ptr);
|
||||||
Bfree (ptr, ptr->_result);
|
Bfree (ptr, _REENT_MP_RESULT(ptr));
|
||||||
ptr->_result = 0;
|
_REENT_MP_RESULT(ptr) = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LDBL_MANT_DIG == 24
|
#if LDBL_MANT_DIG == 24
|
||||||
|
@ -2748,9 +2750,9 @@ if( ndigits > NDEC )
|
||||||
ndigits = NDEC;
|
ndigits = NDEC;
|
||||||
|
|
||||||
/* reentrancy addition to use mprec storage pool */
|
/* reentrancy addition to use mprec storage pool */
|
||||||
ptr->_result = Balloc (ptr, 3);
|
_REENT_MP_RESULT(ptr) = Balloc (ptr, 3);
|
||||||
ptr->_result_k = 3;
|
_REENT_MP_RESULT_K(ptr) = 3;
|
||||||
outstr = (char *)ptr->_result;
|
outstr = (char *)_REENT_MP_RESULT(ptr);
|
||||||
|
|
||||||
etoasc( e, outstr, ndigits, mode, ldp );
|
etoasc( e, outstr, ndigits, mode, ldp );
|
||||||
s = outstr;
|
s = outstr;
|
||||||
|
|
|
@ -17,6 +17,7 @@ long
|
||||||
_DEFUN (_lrand48_r, (r),
|
_DEFUN (_lrand48_r, (r),
|
||||||
struct _reent *r)
|
struct _reent *r)
|
||||||
{
|
{
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
__dorand48(r, __rand48_seed);
|
__dorand48(r, __rand48_seed);
|
||||||
return (long)((unsigned long) __rand48_seed[2] << 15) +
|
return (long)((unsigned long) __rand48_seed[2] << 15) +
|
||||||
((unsigned long) __rand48_seed[1] >> 1);
|
((unsigned long) __rand48_seed[1] >> 1);
|
||||||
|
|
|
@ -3462,6 +3462,7 @@ void malloc_stats(RONEARG) RDECL
|
||||||
MALLOC_UNLOCK;
|
MALLOC_UNLOCK;
|
||||||
|
|
||||||
#ifdef INTERNAL_NEWLIB
|
#ifdef INTERNAL_NEWLIB
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stderr_r (reent_ptr));
|
||||||
fp = _stderr_r(reent_ptr);
|
fp = _stderr_r(reent_ptr);
|
||||||
#define fprintf fiprintf
|
#define fprintf fiprintf
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -95,21 +95,22 @@ _DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k)
|
||||||
int x;
|
int x;
|
||||||
_Bigint *rv ;
|
_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 */
|
/* 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 *),
|
sizeof (struct _Bigint *),
|
||||||
_Kmax + 1);
|
_Kmax + 1);
|
||||||
if (ptr->_freelist == NULL)
|
if (_REENT_MP_FREELIST(ptr) == NULL)
|
||||||
{
|
{
|
||||||
return 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
|
else
|
||||||
{
|
{
|
||||||
|
@ -130,10 +131,11 @@ _DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k)
|
||||||
void
|
void
|
||||||
_DEFUN (Bfree, (ptr, v), struct _reent *ptr _AND _Bigint * v)
|
_DEFUN (Bfree, (ptr, v), struct _reent *ptr _AND _Bigint * v)
|
||||||
{
|
{
|
||||||
|
_REENT_CHECK_MP(ptr);
|
||||||
if (v)
|
if (v)
|
||||||
{
|
{
|
||||||
v->_next = ptr->_freelist[v->_k];
|
v->_next = _REENT_MP_FREELIST(ptr)[v->_k];
|
||||||
ptr->_freelist[v->_k] = v;
|
_REENT_MP_FREELIST(ptr)[v->_k] = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,10 +427,11 @@ _DEFUN (pow5mult,
|
||||||
|
|
||||||
if (!(k >>= 2))
|
if (!(k >>= 2))
|
||||||
return b;
|
return b;
|
||||||
if (!(p5 = ptr->_p5s))
|
_REENT_CHECK_MP(ptr);
|
||||||
|
if (!(p5 = _REENT_MP_P5S(ptr)))
|
||||||
{
|
{
|
||||||
/* first time */
|
/* first time */
|
||||||
p5 = ptr->_p5s = i2b (ptr, 625);
|
p5 = _REENT_MP_P5S(ptr) = i2b (ptr, 625);
|
||||||
p5->_next = 0;
|
p5->_next = 0;
|
||||||
}
|
}
|
||||||
for (;;)
|
for (;;)
|
||||||
|
|
|
@ -17,6 +17,7 @@ long
|
||||||
_DEFUN (_mrand48_r, (r),
|
_DEFUN (_mrand48_r, (r),
|
||||||
struct _reent *r)
|
struct _reent *r)
|
||||||
{
|
{
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
__dorand48(r, __rand48_seed);
|
__dorand48(r, __rand48_seed);
|
||||||
return ((long) __rand48_seed[2] << 16) + (long) __rand48_seed[1];
|
return ((long) __rand48_seed[2] << 16) + (long) __rand48_seed[1];
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,7 @@ _DEFUN (_mstats_r, (ptr, s),
|
||||||
struct _reent *ptr _AND
|
struct _reent *ptr _AND
|
||||||
char *s)
|
char *s)
|
||||||
{
|
{
|
||||||
|
_REENT_SMALL_CHECK_INIT(_stderr_r (ptr));
|
||||||
fiprintf (_stderr_r (ptr), "Memory allocation statistics %s\n", s);
|
fiprintf (_stderr_r (ptr), "Memory allocation statistics %s\n", s);
|
||||||
_malloc_stats_r (ptr);
|
_malloc_stats_r (ptr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ on two different systems.
|
||||||
void
|
void
|
||||||
_DEFUN (srand, (seed), unsigned int seed)
|
_DEFUN (srand, (seed), unsigned int seed)
|
||||||
{
|
{
|
||||||
_REENT->_new._reent._rand_next = seed;
|
_REENT_RAND_NEXT(_REENT) = seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -81,9 +81,10 @@ _DEFUN_VOID (rand)
|
||||||
/* This multiplier was obtained from Knuth, D.E., "The Art of
|
/* This multiplier was obtained from Knuth, D.E., "The Art of
|
||||||
Computer Programming," Vol 2, Seminumerical Algorithms, Third
|
Computer Programming," Vol 2, Seminumerical Algorithms, Third
|
||||||
Edition, Addison-Wesley, 1998, p. 106 (line 26) & p. 108 */
|
Edition, Addison-Wesley, 1998, p. 106 (line 26) & p. 108 */
|
||||||
_REENT->_new._reent._rand_next =
|
_REENT_CHECK_RAND48(_REENT);
|
||||||
_REENT->_new._reent._rand_next * __extension__ 6364136223846793005LL + 1;
|
_REENT_RAND_NEXT(_REENT) =
|
||||||
return (int)((_REENT->_new._reent._rand_next >> 32) & RAND_MAX);
|
_REENT_RAND_NEXT(_REENT) * __extension__ 6364136223846793005LL + 1;
|
||||||
|
return (int)((_REENT_RAND_NEXT(_REENT) >> 32) & RAND_MAX);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _REENT_ONLY */
|
#endif /* _REENT_ONLY */
|
||||||
|
|
|
@ -163,6 +163,7 @@ _DEFUN (__dorand48, (r, xseed),
|
||||||
unsigned long accu;
|
unsigned long accu;
|
||||||
unsigned short temp[2];
|
unsigned short temp[2];
|
||||||
|
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0] +
|
accu = (unsigned long) __rand48_mult[0] * (unsigned long) xseed[0] +
|
||||||
(unsigned long) __rand48_add;
|
(unsigned long) __rand48_add;
|
||||||
temp[0] = (unsigned short) accu; /* lower 16 bits */
|
temp[0] = (unsigned short) accu; /* lower 16 bits */
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
extern void _EXFUN(__dorand48,(struct _reent *r, unsigned short[3]));
|
extern void _EXFUN(__dorand48,(struct _reent *r, unsigned short[3]));
|
||||||
#define __rand48_seed (r->_new._reent._r48._seed)
|
#define __rand48_seed _REENT_RAND48_SEED(r)
|
||||||
#define __rand48_mult (r->_new._reent._r48._mult)
|
#define __rand48_mult _REENT_RAND48_MULT(r)
|
||||||
#define __rand48_add (r->_new._reent._r48._add)
|
#define __rand48_add _REENT_RAND48_ADD(r)
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* following values are defined in <sys/reent.h> */
|
/* following values are defined in <sys/reent.h> */
|
||||||
|
|
|
@ -20,6 +20,7 @@ _DEFUN (_seed48_r, (r, xseed),
|
||||||
{
|
{
|
||||||
static unsigned short sseed[3];
|
static unsigned short sseed[3];
|
||||||
|
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
sseed[0] = __rand48_seed[0];
|
sseed[0] = __rand48_seed[0];
|
||||||
sseed[1] = __rand48_seed[1];
|
sseed[1] = __rand48_seed[1];
|
||||||
sseed[2] = __rand48_seed[2];
|
sseed[2] = __rand48_seed[2];
|
||||||
|
|
|
@ -18,6 +18,7 @@ _DEFUN (_srand48_r, (r, seed),
|
||||||
struct _reent *r _AND
|
struct _reent *r _AND
|
||||||
long seed)
|
long seed)
|
||||||
{
|
{
|
||||||
|
_REENT_CHECK_RAND48(r);
|
||||||
__rand48_seed[0] = _RAND48_SEED_0;
|
__rand48_seed[0] = _RAND48_SEED_0;
|
||||||
__rand48_seed[1] = (unsigned short) seed;
|
__rand48_seed[1] = (unsigned short) seed;
|
||||||
__rand48_seed[2] = (unsigned short) ((unsigned long)seed >> 16);
|
__rand48_seed[2] = (unsigned short) ((unsigned long)seed >> 16);
|
||||||
|
|
|
@ -73,6 +73,7 @@ _DEFUN (strtok, (s, delim),
|
||||||
register char *s _AND
|
register char *s _AND
|
||||||
register const char *delim)
|
register const char *delim)
|
||||||
{
|
{
|
||||||
return strtok_r (s, delim, &(_REENT->_new._reent._strtok_last));
|
static char *last;
|
||||||
|
return strtok_r (s, delim, &last);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -57,8 +57,8 @@ char *
|
||||||
_DEFUN (asctime, (tim_p),
|
_DEFUN (asctime, (tim_p),
|
||||||
_CONST struct tm *tim_p)
|
_CONST struct tm *tim_p)
|
||||||
{
|
{
|
||||||
char *buf = _REENT->_new._reent._asctime_buf;
|
_REENT_CHECK_ASCTIME_BUF(_REENT);
|
||||||
return asctime_r (tim_p, buf);
|
return asctime_r (tim_p, _REENT_ASCTIME_BUF(_REENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -51,7 +51,8 @@ struct tm *
|
||||||
_DEFUN (localtime, (tim_p),
|
_DEFUN (localtime, (tim_p),
|
||||||
_CONST time_t * tim_p)
|
_CONST time_t * tim_p)
|
||||||
{
|
{
|
||||||
return localtime_r (tim_p, (struct tm *)&(_REENT->_new._reent._localtime_buf));
|
_REENT_CHECK_TM(_REENT);
|
||||||
|
return localtime_r (tim_p, (struct tm *)_REENT_TM(_REENT));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -145,11 +145,11 @@ Neither <<gamma>> nor <<gammaf>> is ANSI C. */
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _IEEE_LIBM
|
#ifdef _IEEE_LIBM
|
||||||
return __ieee754_gamma_r(x,&(_REENT->_new._reent._gamma_signgam));
|
return __ieee754_gamma_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
#else
|
#else
|
||||||
double y;
|
double y;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
y = __ieee754_gamma_r(x,&(_REENT->_new._reent._gamma_signgam));
|
y = __ieee754_gamma_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
if(_LIB_VERSION == _IEEE_) return y;
|
if(_LIB_VERSION == _IEEE_) return y;
|
||||||
if(!finite(y)&&finite(x)) {
|
if(!finite(y)&&finite(x)) {
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _IEEE_LIBM
|
#ifdef _IEEE_LIBM
|
||||||
return __ieee754_lgamma_r(x,&(_REENT->_new._reent._gamma_signgam));
|
return __ieee754_lgamma_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
#else
|
#else
|
||||||
double y;
|
double y;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
y = __ieee754_lgamma_r(x,&(_REENT->_new._reent._gamma_signgam));
|
y = __ieee754_lgamma_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
if(_LIB_VERSION == _IEEE_) return y;
|
if(_LIB_VERSION == _IEEE_) return y;
|
||||||
if(!finite(y)&&finite(x)) {
|
if(!finite(y)&&finite(x)) {
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
|
|
@ -26,11 +26,11 @@
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _IEEE_LIBM
|
#ifdef _IEEE_LIBM
|
||||||
return __ieee754_gammaf_r(x,&(_REENT->_new._reent._gamma_signgam));
|
return __ieee754_gammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
#else
|
#else
|
||||||
float y;
|
float y;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
y = __ieee754_gammaf_r(x,&(_REENT->_new._reent._gamma_signgam));
|
y = __ieee754_gammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
if(_LIB_VERSION == _IEEE_) return y;
|
if(_LIB_VERSION == _IEEE_) return y;
|
||||||
if(!finitef(y)&&finitef(x)) {
|
if(!finitef(y)&&finitef(x)) {
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
|
|
@ -26,11 +26,11 @@
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef _IEEE_LIBM
|
#ifdef _IEEE_LIBM
|
||||||
return __ieee754_lgammaf_r(x,&(_REENT->_new._reent._gamma_signgam));
|
return __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
#else
|
#else
|
||||||
float y;
|
float y;
|
||||||
struct exception exc;
|
struct exception exc;
|
||||||
y = __ieee754_lgammaf_r(x,&(_REENT->_new._reent._gamma_signgam));
|
y = __ieee754_lgammaf_r(x,&(_REENT_SIGNGAM(_REENT)));
|
||||||
if(_LIB_VERSION == _IEEE_) return y;
|
if(_LIB_VERSION == _IEEE_) return y;
|
||||||
if(!finitef(y)&&finitef(x)) {
|
if(!finitef(y)&&finitef(x)) {
|
||||||
#ifndef HUGE_VAL
|
#ifndef HUGE_VAL
|
||||||
|
|
Loading…
Reference in New Issue