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

Corinna Vinschen vinschen@redhat.com
Fri May 13 07:53:02 GMT 2022


On May 13 07:44, Sebastian Huber wrote:
> On 12/05/2022 21:44, Corinna Vinschen wrote:
> > diff --git a/winsup/cygwin/cygtls.cc b/winsup/cygwin/cygtls.cc
> > index c8352adf9f25..0fd5509d2306 100644
> > --- a/winsup/cygwin/cygtls.cc
> > +++ b/winsup/cygwin/cygtls.cc
> > @@ -55,16 +55,8 @@ _cygtls::init_thread (void *x, DWORD (*func) (void *, void *))
> >         _REENT_INIT_PTR (&local_clib);
> >         stackptr = stack;
> >         altstack.ss_flags = SS_DISABLE;
> > -      if (_GLOBAL_REENT)
> > -	{
> > -	  local_clib._stdin = _GLOBAL_REENT->_stdin;
> > -	  local_clib._stdout = _GLOBAL_REENT->_stdout;
> > -	  local_clib._stderr = _GLOBAL_REENT->_stderr;
> > -	  if (_GLOBAL_REENT->__cleanup)
> > -	    local_clib.__cleanup = _cygtls::cleanup_early;
> > -	  local_clib.__sglue._niobs = 3;
> > -	  local_clib.__sglue._iobs = &_GLOBAL_REENT->__sf[0];
> > -	}
> > +      if (_GLOBAL_REENT && _GLOBAL_REENT->__cleanup)
> > +	local_clib.__cleanup = _cygtls::cleanup_early;
> 
> We have:
> 
> #define _GLOBAL_REENT (&_impure_data)
> 
> So, the NULL pointer check is superfluous.

Oh, right, thanks!


Corinna



More information about the Newlib mailing list