3 <<reent>>---definition of impure data.
9 This module defines the impure data area used by the
10 non-reentrant functions, such as strtok.
17 #ifndef REENTRANT_SYSCALLS_PROVIDED
18 #define REENTRANT_SYSCALLS_PROVIDED
22 #ifndef REENTRANT_SYSCALLS_PROVIDED
24 /* We use the errno variable used by the system dependent layer. */
31 _reclaim_reent (struct _reent
*ptr
)
33 #ifndef _REENT_THREAD_LOCAL
34 if (ptr
!= _impure_ptr
)
37 /* used by mprec routines. */
39 if (ptr
->_mp
) /* don't bother allocating it! */
42 if (_REENT_MP_FREELIST(ptr
))
45 for (i
= 0; i
< _Kmax
; i
++)
47 struct _Bigint
*thisone
, *nextone
;
49 nextone
= _REENT_MP_FREELIST(ptr
)[i
];
53 nextone
= nextone
->_next
;
54 _free_r (ptr
, thisone
);
58 _free_r (ptr
, _REENT_MP_FREELIST(ptr
));
60 if (_REENT_MP_RESULT(ptr
))
61 _free_r (ptr
, _REENT_MP_RESULT(ptr
));
62 if (_REENT_MP_P5S(ptr
))
64 struct _Bigint
*thisone
, *nextone
;
65 nextone
= _REENT_MP_P5S(ptr
);
69 nextone
= nextone
->_next
;
70 _free_r (ptr
, thisone
);
78 if (_REENT_EMERGENCY(ptr
))
79 _free_r (ptr
, _REENT_EMERGENCY(ptr
));
81 _free_r (ptr
, ptr
->_mp
);
83 _free_r (ptr
, ptr
->_r48
);
84 if (ptr
->_localtime_buf
)
85 _free_r (ptr
, ptr
->_localtime_buf
);
86 if (ptr
->_asctime_buf
)
87 _free_r (ptr
, ptr
->_asctime_buf
);
89 _free_r (ptr
, ptr
->_signal_buf
);
91 _free_r (ptr
, ptr
->_misc
);
94 if (_REENT_CVTBUF(ptr
))
95 _free_r (ptr
, _REENT_CVTBUF(ptr
));
96 /* We should free _sig_func to avoid a memory leak, but how to
97 do it safely considering that a signal may be delivered immediately
99 if (_REENT_SIG_FUNC(ptr))
100 _free_r (ptr, _REENT_SIG_FUNC(ptr));*/
102 if (_REENT_CLEANUP(ptr
))
104 /* cleanup won't reclaim memory 'coz usually it's run
105 before the program exits, and who wants to wait for that? */
106 _REENT_CLEANUP(ptr
) (ptr
);
109 /* Malloc memory not reclaimed; no good way to return memory anyway. */