diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2014-09-05 09:42:15 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2014-09-05 09:42:15 +0000 |
commit | e7565f10886bac86410db6eb6fda47da1d04ac9b (patch) | |
tree | 48b443b792d08d2d0880bce6647f77cee1291b9c /newlib/libc/stdio/findfp.c | |
parent | 1ec7de72712ad91fa5cf486db50938f8657a0c92 (diff) | |
download | cygnal-e7565f10886bac86410db6eb6fda47da1d04ac9b.tar.gz cygnal-e7565f10886bac86410db6eb6fda47da1d04ac9b.tar.bz2 cygnal-e7565f10886bac86410db6eb6fda47da1d04ac9b.zip |
* libc/stdio/findfp.c (_cleanup_r): Call _fflush_r when configuration
option "--enable-lite-exit" is in effect. Refactor the code.
Diffstat (limited to 'newlib/libc/stdio/findfp.c')
-rw-r--r-- | newlib/libc/stdio/findfp.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index 9ee43b53d..27408f548 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -174,17 +174,22 @@ _VOID _DEFUN(_cleanup_r, (ptr), struct _reent *ptr) { + int (*cleanup_func) (struct _reent *, FILE *); #ifdef _STDIO_BSD_SEMANTICS /* BSD and Glibc systems only flush streams which have been written to at exit time. Calling flush rather than close for speed, as on the aforementioned systems. */ - _CAST_VOID _fwalk_reent (ptr, __sflushw_r); + cleanup_func = __sflushw_r; #else /* Otherwise close files and flush read streams, too. - FIXME: Do we really have to call fclose rather than fflush for - RTOS compatibility? */ - _CAST_VOID _fwalk_reent (ptr, _fclose_r); + Note we call flush directly if "--enable-lite-exit" is in effect. */ +#ifdef _LITE_EXIT + cleanup_func = _fflush_r; +#else + cleanup_func = _fclose_r; +#endif #endif + _CAST_VOID _fwalk_reent (ptr, cleanup_func); } #ifndef _REENT_ONLY |