diff options
Diffstat (limited to 'newlib/libc/stdio/local.h')
-rw-r--r-- | newlib/libc/stdio/local.h | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 301abce33..9ae9b4046 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -48,7 +48,31 @@ struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); /* Called by the main entry point fns to ensure stdio has been initialized. */ -#define CHECK_INIT(ptr) \ +#ifdef _REENT_SMALL +#define CHECK_INIT(ptr, fp) \ + do \ + { \ + if ((ptr) && !(ptr)->__sdidinit) \ + __sinit (ptr); \ + if ((fp) == (FILE *)&__sf_fake_stdin) \ + (fp) = stdin; \ + else if ((fp) == (FILE *)&__sf_fake_stdout) \ + (fp) = stdout; \ + else if ((fp) == (FILE *)&__sf_fake_stderr) \ + (fp) = stderr; \ + } \ + while (0) +#else /* !_REENT_SMALL */ +#define CHECK_INIT(ptr, fp) \ + do \ + { \ + if ((ptr) && !(ptr)->__sdidinit) \ + __sinit (ptr); \ + } \ + while (0) +#endif /* !_REENT_SMALL */ + +#define CHECK_STD_INIT(ptr) \ do \ { \ if ((ptr) && !(ptr)->__sdidinit) \ |