summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-19 14:12:06 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-04-21 07:29:40 +0200
commit36cd27c1e3ebb3796fa486cddd36b43b7be4cb6b (patch)
treeef589792781b889c8bf8bee1e46c13815770a575
parentscore: Simplify _Objects_Initialize_information() (diff)
downloadrtems-36cd27c1e3ebb3796fa486cddd36b43b7be4cb6b.tar.bz2
score: Simplify _Objects_Get_next()
Remove unused location parameter.
-rw-r--r--cpukit/libcsupport/src/resource_snapshot.c4
-rw-r--r--cpukit/libmisc/monitor/mon-manager.c3
-rw-r--r--cpukit/score/include/rtems/score/objectimpl.h12
-rw-r--r--cpukit/score/src/objectgetnext.c15
-rw-r--r--testsuites/sptests/spobjgetnext/init.c14
5 files changed, 15 insertions, 33 deletions
diff --git a/cpukit/libcsupport/src/resource_snapshot.c b/cpukit/libcsupport/src/resource_snapshot.c
index 198015593f..469df72b05 100644
--- a/cpukit/libcsupport/src/resource_snapshot.c
+++ b/cpukit/libcsupport/src/resource_snapshot.c
@@ -107,10 +107,8 @@ static void get_heap_info(Heap_Control *heap, Heap_Information_block *info)
static POSIX_Keys_Control *get_next_key(Objects_Id *id)
{
- Objects_Locations location;
-
return (POSIX_Keys_Control *)
- _Objects_Get_next(&_POSIX_Keys_Information, *id, &location, id);
+ _Objects_Get_next(*id, &_POSIX_Keys_Information, id);
}
static uint32_t get_active_posix_key_value_pairs(void)
diff --git a/cpukit/libmisc/monitor/mon-manager.c b/cpukit/libmisc/monitor/mon-manager.c
index 99c28acc09..d165c4fccd 100644
--- a/cpukit/libmisc/monitor/mon-manager.c
+++ b/cpukit/libmisc/monitor/mon-manager.c
@@ -26,7 +26,6 @@ rtems_monitor_manager_next(
Objects_Information *table = table_void;
rtems_monitor_generic_t *copy;
Objects_Control *object = 0;
- Objects_Locations location;
/*
* When we are called, it must be local
@@ -37,7 +36,7 @@ rtems_monitor_manager_next(
goto done;
#endif
- object = _Objects_Get_next(table, *next_id, &location, next_id);
+ object = _Objects_Get_next(*next_id, table, next_id);
if (object)
{
diff --git a/cpukit/score/include/rtems/score/objectimpl.h b/cpukit/score/include/rtems/score/objectimpl.h
index 47d17dd37a..6877b8e9fe 100644
--- a/cpukit/score/include/rtems/score/objectimpl.h
+++ b/cpukit/score/include/rtems/score/objectimpl.h
@@ -680,19 +680,19 @@ Objects_Control *_Objects_Get_no_protection(
*
* Locks the object allocator mutex in case a next object exists.
*
- * @param[in] information points to an object class information block.
* @param[in] id is the Id of the object whose name we are locating.
- * @param[in] location_p will contain an indication of success or failure.
+ * This is the first parameter since usual callers get the object identifier
+ * as the first parameter themself.
+ * @param[in] information points to an object class information block.
* @param[in] next_id_p is the Id of the next object we will look at.
*
* @retval This method returns the pointer to the object located or
* NULL on error.
*/
Objects_Control *_Objects_Get_next(
- Objects_Information *information,
- Objects_Id id,
- Objects_Locations *location_p,
- Objects_Id *next_id_p
+ Objects_Id id,
+ const Objects_Information *information,
+ Objects_Id *next_id_p
);
/**
diff --git a/cpukit/score/src/objectgetnext.c b/cpukit/score/src/objectgetnext.c
index c0ebbbed98..2d4f252b97 100644
--- a/cpukit/score/src/objectgetnext.c
+++ b/cpukit/score/src/objectgetnext.c
@@ -20,12 +20,10 @@
#include <rtems/score/objectimpl.h>
-Objects_Control *
-_Objects_Get_next(
- Objects_Information *information,
- Objects_Id id,
- Objects_Locations *location_p,
- Objects_Id *next_id_p
+Objects_Control *_Objects_Get_next(
+ Objects_Id id,
+ const Objects_Information *information,
+ Objects_Id *next_id_p
)
{
Objects_Control *the_object;
@@ -34,9 +32,6 @@ _Objects_Get_next(
if ( !information )
return NULL;
- if ( !location_p )
- return NULL;
-
if ( !next_id_p )
return NULL;
@@ -52,7 +47,6 @@ _Objects_Get_next(
if (_Objects_Get_index(next_id) > information->maximum)
{
_Objects_Allocator_unlock();
- *location_p = OBJECTS_ERROR;
*next_id_p = OBJECTS_ID_FINAL;
return NULL;
}
@@ -64,7 +58,6 @@ _Objects_Get_next(
} while ( the_object == NULL );
- *location_p = OBJECTS_LOCAL;
*next_id_p = next_id;
return the_object;
}
diff --git a/testsuites/sptests/spobjgetnext/init.c b/testsuites/sptests/spobjgetnext/init.c
index c6b8de5a2d..620185c1f3 100644
--- a/testsuites/sptests/spobjgetnext/init.c
+++ b/testsuites/sptests/spobjgetnext/init.c
@@ -35,7 +35,6 @@ int scan_objects(
{
Objects_Control *o[MAX_SCAN];
int i;
- Objects_Locations location;
Objects_Id id;
memset( o, 1, sizeof(o) );
@@ -43,15 +42,12 @@ int scan_objects(
id = start;
for (i=0 ; i<MAX_SCAN ; i++ ) {
o[i] = _Objects_Get_next(
- information,
id,
- &location,
+ information,
&id
);
if ( !o[i] )
break;
- if ( location == OBJECTS_ERROR )
- break;
/* XXX check dispatch level with macros */
/* XXX should be able to check that next Id is not one we have seen */
@@ -66,7 +62,6 @@ rtems_task Init(
rtems_id main_task;
int count;
Objects_Control *o;
- Objects_Locations location;
Objects_Id id;
Objects_Information *info;
Objects_Maximum active_count;
@@ -77,15 +72,12 @@ rtems_task Init(
main_task = rtems_task_self();
puts( "Init - _Objects_Get_next - NULL object information" );
- o = _Objects_Get_next( NULL, main_task, &location, &id );
+ o = _Objects_Get_next( main_task, NULL, &id );
rtems_test_assert( o == NULL );
-
- puts( "Init - _Objects_Get_next - NULL location" );
- o = _Objects_Get_next( info, main_task, NULL, &id );
rtems_test_assert( o == NULL );
puts( "Init - _Objects_Get_next - NULL id" );
- o = _Objects_Get_next( info, main_task, &location, NULL );
+ o = _Objects_Get_next( main_task, info, NULL );
rtems_test_assert( o == NULL );
/* XXX push the three NULL error cases */