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 | |
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.
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/stdio/findfp.c | 13 |
2 files changed, 14 insertions, 4 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 8f718214c..909dee6ed 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,5 +1,10 @@ 2014-09-05 Bin Cheng <bin.cheng@arm.com> + * libc/stdio/findfp.c (_cleanup_r): Call _fflush_r when configuration + option "--enable-lite-exit" is in effect. Refactor the code. + +2014-09-05 Bin Cheng <bin.cheng@arm.com> + * libc/stdio/fwalk.c (_fwalk_reent): Remove redundant test. 2014-09-04 Freddie Chopin <freddie_chopin@op.pl> 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 |