diff options
author | Matt Joyce <matthew.joyce@embedded-brains.de> | 2022-05-03 06:17:15 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2022-05-13 12:32:38 +0200 |
commit | a7bdda05038d3a95daed5aca7d0d4c6ce755e1d9 (patch) | |
tree | ad2f4023d5ad3194d3bbcbc5ec0fd9bfa6f7b9f4 /newlib/libc/stdio/findfp.c | |
parent | d83aa402b7ba3e3ec16d247a26cc8343a2e7efa3 (diff) | |
download | newlib-a7bdda05038d3a95daed5aca7d0d4c6ce755e1d9.zip newlib-a7bdda05038d3a95daed5aca7d0d4c6ce755e1d9.tar.gz newlib-a7bdda05038d3a95daed5aca7d0d4c6ce755e1d9.tar.bz2 |
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.
Diffstat (limited to 'newlib/libc/stdio/findfp.c')
-rw-r--r-- | newlib/libc/stdio/findfp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index afbdad9..7434c34 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]); |