public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] Move __sglue initializations to __sfp()
Date: Fri, 13 May 2022 11:19:52 +0000 (GMT)	[thread overview]
Message-ID: <20220513111952.1D1513839C5E@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=a7bdda05038d3a95daed5aca7d0d4c6ce755e1d9

commit a7bdda05038d3a95daed5aca7d0d4c6ce755e1d9
Author: Matt Joyce <matthew.joyce@embedded-brains.de>
Date:   Tue May 3 06:17:15 2022 +0200

    Move __sglue initializations to __sfp()
    
    Moved last remaining  __sglue initializations from __sinit() to
    __sfp(). The move better encapsulates access to __sglue and
    facilitates its decoupling from struct _reent in a follow-on patch.

Diff:
---
 newlib/libc/stdio/findfp.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index afbdad9b1..7434c343c 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -151,8 +151,14 @@ __sfp (struct _reent *d)
 
   _newlib_sfp_lock_start ();
 
-  if (_GLOBAL_REENT->__cleanup == NULL)
+  if (_GLOBAL_REENT->__cleanup == NULL) {
+#ifdef _REENT_GLOBAL_STDIO_STREAMS
+    _GLOBAL_REENT->__sglue._niobs = 3;
+    _GLOBAL_REENT->__sglue._iobs = &__sf[0];
+#endif
     __sinit (_GLOBAL_REENT);
+  }
+
   for (g = &_GLOBAL_REENT->__sglue;; g = g->_next)
     {
       for (fp = g->_iobs, n = g->_niobs; --n >= 0; fp++)
@@ -256,8 +262,6 @@ __sinit (struct _reent *s)
 
 #ifdef _REENT_GLOBAL_STDIO_STREAMS
   if (__sf[0]._cookie == NULL) {
-    _GLOBAL_REENT->__sglue._niobs = 3;
-    _GLOBAL_REENT->__sglue._iobs = &__sf[0];
     stdin_init (&__sf[0]);
     stdout_init (&__sf[1]);
     stderr_init (&__sf[2]);


                 reply	other threads:[~2022-05-13 11:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220513111952.1D1513839C5E@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).