summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/objectallocatebyindex.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-01-05 20:09:02 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-01-05 20:09:02 +0000
commitb028e725e35629e0405d237942e97a73843ae35b (patch)
tree5cac5182644fcd11fe996272790b2b9a62cec67b /cpukit/score/src/objectallocatebyindex.c
parent2009-01-05 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-b028e725e35629e0405d237942e97a73843ae35b.tar.bz2
2009-01-05 Joel Sherrill <joel.sherrill@oarcorp.com>
* score/include/rtems/score/object.h, score/src/objectallocatebyindex.c: Object index should be int. Fix bug when index is negative. * score/src/objectextendinformation.c: Do not allow maximum number of allocated objects to exceed maximum representable in index field of Object Id. * score/src/objectgetisr.c: Use same code that is in _Objects_Get to extract index field of Object Id.
Diffstat (limited to 'cpukit/score/src/objectallocatebyindex.c')
-rw-r--r--cpukit/score/src/objectallocatebyindex.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/cpukit/score/src/objectallocatebyindex.c b/cpukit/score/src/objectallocatebyindex.c
index 474fec0d6f..32a2c15e14 100644
--- a/cpukit/score/src/objectallocatebyindex.c
+++ b/cpukit/score/src/objectallocatebyindex.c
@@ -41,21 +41,22 @@
Objects_Control *_Objects_Allocate_by_index(
Objects_Information *information,
- uint16_t the_index,
+ int the_index,
uint16_t sizeof_control
)
{
Objects_Control *the_object;
- if ( the_index && information->maximum >= the_index ) {
+ if ( the_index > 0 && information->maximum >= the_index ) {
the_object = information->local_table[ the_index ];
if ( the_object )
return NULL;
/* XXX
- * This whole section of code needs to be addressed.
+ * This whole section of code needs to be evaluated for unlimited objects.
* + The 0 should be dealt with more properly so we can autoextend.
- * + The pointer arithmetic is probably too expensive.
+ * + The pointer arithmetic is probably too expensive but is likely
+ * necessary especially on targets with 16 bit offset limits.
* + etc.
*/