[PATCH 1/3] libcsupport: Use _reclaim_reent()

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 8 13:25:00 UTC 2013


---
 cpukit/libcsupport/src/newlibc_reent.c |   29 +----------------------------
 1 files changed, 1 insertions(+), 28 deletions(-)

diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c
index 364ef8b..972248f 100644
--- a/cpukit/libcsupport/src/newlibc_reent.c
+++ b/cpukit/libcsupport/src/newlibc_reent.c
@@ -25,12 +25,9 @@
 
 #include <sys/reent.h>
 #include <stdlib.h>
-#include <stdio.h>
 
 #include <rtems/libcsupport.h>
 
-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);
 }
 
-- 
1.7.7




More information about the devel mailing list