From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id ED8BB3838001 for ; Tue, 10 May 2022 08:09:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org ED8BB3838001 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy06.your-server.de ([78.46.172.3]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1noKw8-000MqE-IA for newlib@sourceware.org; Tue, 10 May 2022 10:09:40 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1noKw8-000HEj-MK for newlib@sourceware.org; Tue, 10 May 2022 10:09:40 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 6124F480162 for ; Tue, 10 May 2022 10:09:40 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id f8sTsNejyMUB; Tue, 10 May 2022 10:09:40 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 180304800DF; Tue, 10 May 2022 10:09:40 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id O5eJftgz1QDY; Tue, 10 May 2022 10:09:40 +0200 (CEST) Received: from joyce-tux.eb.localhost (unknown [10.10.171.30]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 8DE544800B0; Tue, 10 May 2022 10:09:39 +0200 (CEST) From: Matthew Joyce To: newlib@sourceware.org Subject: [PATCH 06/11] Move __sglue initializations to __sfp() Date: Tue, 10 May 2022 10:09:22 +0200 Message-Id: <20220510080927.28839-7-matthew.joyce@embedded-brains.de> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220510080927.28839-1-matthew.joyce@embedded-brains.de> References: <20220510080927.28839-1-matthew.joyce@embedded-brains.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.5/26536/Mon May 9 10:04:57 2022) X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 May 2022 08:09:43 -0000 From: Matt Joyce 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. --- 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) =20 _newlib_sfp_lock_start (); =20 - if (_GLOBAL_REENT->__cleanup =3D=3D NULL) + if (_GLOBAL_REENT->__cleanup =3D=3D NULL) { +#ifdef _REENT_GLOBAL_STDIO_STREAMS + _GLOBAL_REENT->__sglue._niobs =3D 3; + _GLOBAL_REENT->__sglue._iobs =3D &__sf[0]; +#endif __sinit (_GLOBAL_REENT); + } + for (g =3D &_GLOBAL_REENT->__sglue;; g =3D g->_next) { for (fp =3D g->_iobs, n =3D g->_niobs; --n >=3D 0; fp++) @@ -256,8 +262,6 @@ __sinit (struct _reent *s) =20 #ifdef _REENT_GLOBAL_STDIO_STREAMS if (__sf[0]._cookie =3D=3D NULL) { - _GLOBAL_REENT->__sglue._niobs =3D 3; - _GLOBAL_REENT->__sglue._iobs =3D &__sf[0]; stdin_init (&__sf[0]); stdout_init (&__sf[1]); stderr_init (&__sf[2]); --=20 2.31.1