From 8b721d5e11e9b4d6d8998e7b92d34c69b20e2c31 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 25 Apr 2013 10:48:16 +0200 Subject: libcsupport: Use _reclaim_reent() A Newlib including the following patch is required: 2013-04-25 Sebastian Huber * libc/stdio/local.h (_STDIO_CLOSE_PER_REENT_STD_STREAMS): New define. * libc/stdio/findfp.c (_STDIO_CLOSE_PER_REENT_STD_STREAMS): Use define. --- cpukit/libcsupport/src/newlibc_reent.c | 29 +---------------------------- 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c index 364ef8bbec..972248fa67 100644 --- a/cpukit/libcsupport/src/newlibc_reent.c +++ b/cpukit/libcsupport/src/newlibc_reent.c @@ -25,12 +25,9 @@ #include #include -#include #include -int _fwalk(struct _reent *ptr, int (*function) (FILE *) ); - bool newlib_create_hook( rtems_tcb *current_task __attribute__((unused)), rtems_tcb *creating_task @@ -60,26 +57,6 @@ bool newlib_create_hook( return ok; } -static int newlib_free_buffers( - FILE *fp -) -{ - switch ( fileno(fp) ) { - case 0: - case 1: - case 2: - if (fp->_flags & __SMBF) { - free( fp->_bf._base ); - fp->_flags &= ~__SMBF; - fp->_bf._base = fp->_p = (unsigned char *) NULL; - } - break; - default: - fclose(fp); - } - return 0; -} - void newlib_delete_hook( rtems_tcb *current_task, rtems_tcb *deleted_task @@ -90,11 +67,7 @@ void newlib_delete_hook( ptr = deleted_task->libc_reent; deleted_task->libc_reent = NULL; - /* - * Just in case there are some buffers lying around. - */ - _fwalk(ptr, newlib_free_buffers); - + _reclaim_reent(ptr); _Workspace_Free(ptr); } -- cgit v1.2.3