Re: [PATCH v2 00/11] Decouple global file object list from _GLOBAL_REENT

Corinna Vinschen <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.