[PATCH v2 00/11] Decouple global file object list from _GLOBAL_REENT
Corinna Vinschen
vinschen@redhat.com
Fri May 13 11:20:10 GMT 2022
On May 13 12:54, Sebastian Huber wrote:
> On 12/05/2022 21:44, Corinna Vinschen wrote:
> > diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
> > index 5f460d8a5c78..6b816763e002 100644
> > --- a/winsup/cygwin/dcrt0.cc
> > +++ b/winsup/cygwin/dcrt0.cc
> > @@ -757,9 +757,7 @@ dll_crt0_0 ()
> > lock_process::init ();
> > _impure_ptr = _GLOBAL_REENT;
> > - _impure_ptr->_stdin = &_impure_ptr->__sf[0];
> > - _impure_ptr->_stdout = &_impure_ptr->__sf[1];
> > - _impure_ptr->_stderr = &_impure_ptr->__sf[2];
> > + _REENT_INIT_PTR_ZEROED (_GLOBAL_REENT);
> > user_data->impure_ptr = _impure_ptr;
> > user_data->impure_ptr_ptr = &_impure_ptr;
>
> The _GLOBAL_REENT == (&_impure_data) is statically initialized in impure.c:
>
> struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT
> (_impure_data);
>
> I guess you don't need the _REENT_INIT_PTR_ZEROED (_GLOBAL_REENT).
You're right, and more: Given that impure.c also sets _impure_ptr to
&_impure_data statically, setting _impure_ptr to _GLOBAL_REENT is
redundant as well. Nice.
Thanks,
Corinna
More information about the Newlib
mailing list