change log for rtems (2011-02-15)

rtems-vc at rtems.org rtems-vc at rtems.org
Wed Feb 16 01:10:33 UTC 2011


 *joel*:
2011-02-15	Joel Sherrill <joel.sherrilL at OARcorp.com>

	* libmisc/capture/capture.c, posix/src/keyfreememory.c,
	posix/src/pthread.c, score/include/rtems/score/wkspace.h,
	score/src/objectextendinformation.c,
	score/src/objectnamespaceremove.c, score/src/objectsetname.c,
	score/src/threadclose.c, score/src/threadinitialize.c,
	score/src/wkspace.c: Many places were checking for a NULL pointer
	before calling _Workspace_Free. By moving the check into
	_Workspace_Free, we eliminate a number of conditional paths and make
	it harder to return a NULL pointer.

M 1.2713  cpukit/ChangeLog
M   1.22  cpukit/libmisc/capture/capture.c
M    1.2  cpukit/posix/src/keyfreememory.c
M   1.82  cpukit/posix/src/pthread.c
M   1.31  cpukit/score/include/rtems/score/wkspace.h
M   1.23  cpukit/score/src/objectextendinformation.c
M    1.3  cpukit/score/src/objectnamespaceremove.c
M    1.9  cpukit/score/src/objectsetname.c
M   1.15  cpukit/score/src/threadclose.c
M   1.42  cpukit/score/src/threadinitialize.c
M   1.34  cpukit/score/src/wkspace.c

diff -u rtems/cpukit/ChangeLog:1.2712 rtems/cpukit/ChangeLog:1.2713
--- rtems/cpukit/ChangeLog:1.2712	Mon Feb 14 20:31:05 2011
+++ rtems/cpukit/ChangeLog	Tue Feb 15 18:24:48 2011
@@ -1,3 +1,15 @@
+2011-02-15	Joel Sherrill <joel.sherrilL at OARcorp.com>
+
+	* libmisc/capture/capture.c, posix/src/keyfreememory.c,
+	posix/src/pthread.c, score/include/rtems/score/wkspace.h,
+	score/src/objectextendinformation.c,
+	score/src/objectnamespaceremove.c, score/src/objectsetname.c,
+	score/src/threadclose.c, score/src/threadinitialize.c,
+	score/src/wkspace.c: Many places were checking for a NULL pointer
+	before calling _Workspace_Free. By moving the check into
+	_Workspace_Free, we eliminate a number of conditional paths and make
+	it harder to return a NULL pointer.
+
 2011-02-14	Joel Sherrill <joel.sherrill at oarcorp.com>
 
 	* rtems/src/semtranslatereturncode.c,

diff -u rtems/cpukit/libmisc/capture/capture.c:1.21 rtems/cpukit/libmisc/capture/capture.c:1.22
--- rtems/cpukit/libmisc/capture/capture.c:1.21	Fri Jan 21 13:40:17 2011
+++ rtems/cpukit/libmisc/capture/capture.c	Tue Feb 15 18:24:49 2011
@@ -494,8 +494,7 @@
 
     rtems_interrupt_enable (level);
 
-    if (task)
-      _Workspace_Free (task);
+    _Workspace_Free (task);
   }
 }
 

diff -u rtems/cpukit/posix/src/keyfreememory.c:1.1 rtems/cpukit/posix/src/keyfreememory.c:1.2
--- rtems/cpukit/posix/src/keyfreememory.c:1.1	Mon Jul 26 17:03:18 2010
+++ rtems/cpukit/posix/src/keyfreememory.c	Tue Feb 15 18:24:49 2011
@@ -25,6 +25,5 @@
   uint32_t            the_api;
 
   for ( the_api = 1; the_api <= OBJECTS_APIS_LAST; the_api++ )
-    if ( the_key->Values[ the_api ] )
-      _Workspace_Free( the_key->Values[ the_api ] );
+    _Workspace_Free( the_key->Values[ the_api ] );
 }

diff -u rtems/cpukit/posix/src/pthread.c:1.81 rtems/cpukit/posix/src/pthread.c:1.82
--- rtems/cpukit/posix/src/pthread.c:1.81	Mon Oct  4 10:32:36 2010
+++ rtems/cpukit/posix/src/pthread.c	Tue Feb 15 18:24:49 2011
@@ -270,7 +270,7 @@
 
   deleted->API_Extensions[ THREAD_API_POSIX ] = NULL;
 
-  (void) _Workspace_Free( api );
+  _Workspace_Free( api );
 }
 
 /*

diff -u rtems/cpukit/score/include/rtems/score/wkspace.h:1.30 rtems/cpukit/score/include/rtems/score/wkspace.h:1.31
--- rtems/cpukit/score/include/rtems/score/wkspace.h:1.30	Fri Nov 27 23:58:54 2009
+++ rtems/cpukit/score/include/rtems/score/wkspace.h	Tue Feb 15 18:24:49 2011
@@ -70,10 +70,12 @@
  *
  *  @param block is the memory to free
  *
- *  @return true if the free was successful.
+ *  @note If @a block is equal to NULL, then the request is ignored.
+ *        This allows the caller to not worry about whether or not
+ *        a pointer is NULL.
  */
 
-bool _Workspace_Free(
+void _Workspace_Free(
   void *block
 );
 

diff -u rtems/cpukit/score/src/objectextendinformation.c:1.22 rtems/cpukit/score/src/objectextendinformation.c:1.23
--- rtems/cpukit/score/src/objectextendinformation.c:1.22	Mon Jun 21 11:27:37 2010
+++ rtems/cpukit/score/src/objectextendinformation.c	Tue Feb 15 18:24:49 2011
@@ -221,8 +221,7 @@
 
     _ISR_Enable( level );
 
-    if ( old_tables )
-      _Workspace_Free( old_tables );
+    _Workspace_Free( old_tables );
 
     block_count++;
   }

diff -u rtems/cpukit/score/src/objectnamespaceremove.c:1.2 rtems/cpukit/score/src/objectnamespaceremove.c:1.3
--- rtems/cpukit/score/src/objectnamespaceremove.c:1.2	Fri Sep 11 09:54:29 2009
+++ rtems/cpukit/score/src/objectnamespaceremove.c	Tue Feb 15 18:24:49 2011
@@ -26,7 +26,7 @@
     /*
      *  If this is a string format name, then free the memory.
      */
-    if ( information->is_string && the_object->name.name_p )
+    if ( information->is_string )
        _Workspace_Free( (void *)the_object->name.name_p );
   #endif
 

diff -u rtems/cpukit/score/src/objectsetname.c:1.8 rtems/cpukit/score/src/objectsetname.c:1.9
--- rtems/cpukit/score/src/objectsetname.c:1.8	Mon Dec  7 11:27:46 2009
+++ rtems/cpukit/score/src/objectsetname.c	Tue Feb 15 18:24:49 2011
@@ -47,10 +47,8 @@
     if ( !d )
       return false;
 
-    if ( the_object->name.name_p ) {
-      _Workspace_Free( (void *)the_object->name.name_p );
-      the_object->name.name_p = NULL;
-    }
+    _Workspace_Free( (void *)the_object->name.name_p );
+    the_object->name.name_p = NULL;
 
     strncpy( d, name, length );
     d[length] = '\0';

diff -u rtems/cpukit/score/src/threadclose.c:1.14 rtems/cpukit/score/src/threadclose.c:1.15
--- rtems/cpukit/score/src/threadclose.c:1.14	Fri Jan 28 14:24:53 2011
+++ rtems/cpukit/score/src/threadclose.c	Tue Feb 15 18:24:49 2011
@@ -101,8 +101,7 @@
 #endif
   the_thread->fp_context = NULL;
 
-  if ( the_thread->Start.fp_context )
-    (void) _Workspace_Free( the_thread->Start.fp_context );
+  _Workspace_Free( the_thread->Start.fp_context );
 #endif
 
   /*
@@ -112,7 +111,6 @@
   _Thread_Stack_Free( the_thread );
   the_thread->Start.stack = NULL;
 
-  if ( the_thread->extensions )
-    (void) _Workspace_Free( the_thread->extensions );
+  _Workspace_Free( the_thread->extensions );
   the_thread->extensions = NULL;
 }

diff -u rtems/cpukit/score/src/threadinitialize.c:1.41 rtems/cpukit/score/src/threadinitialize.c:1.42
--- rtems/cpukit/score/src/threadinitialize.c:1.41	Fri Jan 28 14:24:54 2011
+++ rtems/cpukit/score/src/threadinitialize.c	Tue Feb 15 18:24:49 2011
@@ -225,26 +225,19 @@
     return true;
 
 failed:
-  if ( the_thread->libc_reent )
-    _Workspace_Free( the_thread->libc_reent );
+  _Workspace_Free( the_thread->libc_reent );
 
   for ( i=0 ; i <= THREAD_API_LAST ; i++ )
-    if ( the_thread->API_Extensions[i] )
-      _Workspace_Free( the_thread->API_Extensions[i] );
+    _Workspace_Free( the_thread->API_Extensions[i] );
 
-  if ( extensions_area )
-    (void) _Workspace_Free( extensions_area );
+  _Workspace_Free( extensions_area );
 
   #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
-    if ( fp_area )
-      (void) _Workspace_Free( fp_area );
+    _Workspace_Free( fp_area );
   #endif
 
-  if ( sched )
-    (void) _Workspace_Free( sched );
+   _Workspace_Free( sched );
 
    _Thread_Stack_Free( the_thread );
   return false;
-
-
 }

diff -u rtems/cpukit/score/src/wkspace.c:1.33 rtems/cpukit/score/src/wkspace.c:1.34
--- rtems/cpukit/score/src/wkspace.c:1.33	Wed Apr  7 12:05:29 2010
+++ rtems/cpukit/score/src/wkspace.c	Tue Feb 15 18:24:49 2011
@@ -79,7 +79,7 @@
 /*
  *  _Workspace_Free
  */
-bool _Workspace_Free(
+void _Workspace_Free(
   void *block
 )
 {
@@ -91,7 +91,8 @@
       __builtin_return_address( 1 )
     );
   #endif
-   return _Heap_Free( &_Workspace_Area, block );
+   if (block)
+     _Heap_Free( &_Workspace_Area, block );
 }
 
 /*



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110215/4bab5c7a/attachment-0001.html>


More information about the vc mailing list