summaryrefslogtreecommitdiffstats
path: root/cpukit/score
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2018-10-25 12:05:53 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2018-10-29 10:33:33 +0100
commit70382718450c6b5d83232188cc71b6c795048a27 (patch)
tree454cdea0181e12e183532d24cc7483fa28c9a09e /cpukit/score
parentscore: Remove bogus thread object name support (diff)
downloadrtems-70382718450c6b5d83232188cc71b6c795048a27.tar.bz2
Remove RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES
Enable support for string objects names unconditionally. Add const qualifier throughout. Split _Objects_Namespace_remove() into _Objects_Namespace_remove_u32() and _Objects_Namespace_remove_string() to avoid an unnecessary dependency on _Workspace_Free(). Update #2514.
Diffstat (limited to 'cpukit/score')
-rw-r--r--cpukit/score/src/objectclose.c6
-rw-r--r--cpukit/score/src/objectgetnameasstring.c17
-rw-r--r--cpukit/score/src/objectidtoname.c6
-rw-r--r--cpukit/score/src/objectinitializeinformation.c4
-rw-r--r--cpukit/score/src/objectnamespaceremove.c34
-rw-r--r--cpukit/score/src/objectnametoidstring.c2
-rw-r--r--cpukit/score/src/objectsetname.c12
7 files changed, 32 insertions, 49 deletions
diff --git a/cpukit/score/src/objectclose.c b/cpukit/score/src/objectclose.c
index 52eb10c60b..e5ee4b5d46 100644
--- a/cpukit/score/src/objectclose.c
+++ b/cpukit/score/src/objectclose.c
@@ -21,11 +21,11 @@
#include <rtems/score/objectimpl.h>
void _Objects_Close(
- Objects_Information *information,
- Objects_Control *the_object
+ const Objects_Information *information,
+ Objects_Control *the_object
)
{
_Objects_Invalidate_Id( information, the_object );
- _Objects_Namespace_remove( information, the_object );
+ _Objects_Namespace_remove_u32( information, the_object );
}
diff --git a/cpukit/score/src/objectgetnameasstring.c b/cpukit/score/src/objectgetnameasstring.c
index f23b1599e1..ed6a73c0f8 100644
--- a/cpukit/score/src/objectgetnameasstring.c
+++ b/cpukit/score/src/objectgetnameasstring.c
@@ -45,12 +45,9 @@ size_t _Objects_Name_to_string(
char *d;
size_t i;
-#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
if ( is_string ) {
s = name.name_p;
- } else
-#endif
- {
+ } else {
lname[ 0 ] = (name.name_u32 >> 24) & 0xff;
lname[ 1 ] = (name.name_u32 >> 16) & 0xff;
lname[ 2 ] = (name.name_u32 >> 8) & 0xff;
@@ -93,10 +90,10 @@ char *_Objects_Get_name_as_string(
char *name
)
{
- Objects_Information *information;
- Objects_Control *the_object;
- ISR_lock_Context lock_context;
- Objects_Id tmpId;
+ const Objects_Information *information;
+ const Objects_Control *the_object;
+ ISR_lock_Context lock_context;
+ Objects_Id tmpId;
if ( length == 0 )
return NULL;
@@ -117,11 +114,7 @@ char *_Objects_Get_name_as_string(
_Objects_Name_to_string(
the_object->name,
-#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
information->is_string,
-#else
- false,
-#endif
name,
length
);
diff --git a/cpukit/score/src/objectidtoname.c b/cpukit/score/src/objectidtoname.c
index aff3296738..85eb409a8e 100644
--- a/cpukit/score/src/objectidtoname.c
+++ b/cpukit/score/src/objectidtoname.c
@@ -40,10 +40,8 @@ Objects_Name_or_id_lookup_errors _Objects_Id_to_name (
if ( !information )
return OBJECTS_INVALID_ID;
- #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
- if ( information->is_string )
- return OBJECTS_INVALID_ID;
- #endif
+ if ( information->is_string )
+ return OBJECTS_INVALID_ID;
the_object = _Objects_Get(
tmpId,
diff --git a/cpukit/score/src/objectinitializeinformation.c b/cpukit/score/src/objectinitializeinformation.c
index 8b1b88db07..23c7819bfa 100644
--- a/cpukit/score/src/objectinitializeinformation.c
+++ b/cpukit/score/src/objectinitializeinformation.c
@@ -49,9 +49,7 @@ void _Objects_Do_initialize_information(
information->inactive_per_block = 0;
information->object_blocks = 0;
information->inactive = 0;
- #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
- information->is_string = is_string;
- #endif
+ information->is_string = is_string;
/*
* Set the maximum value to 0. It will be updated when objects are
diff --git a/cpukit/score/src/objectnamespaceremove.c b/cpukit/score/src/objectnamespaceremove.c
index 6698737254..cc2c954a77 100644
--- a/cpukit/score/src/objectnamespaceremove.c
+++ b/cpukit/score/src/objectnamespaceremove.c
@@ -22,24 +22,24 @@
#include <rtems/score/objectimpl.h>
#include <rtems/score/wkspace.h>
-void _Objects_Namespace_remove(
- Objects_Information *information,
- Objects_Control *the_object
+void _Objects_Namespace_remove_u32(
+ const Objects_Information *information,
+ Objects_Control *the_object
)
{
- #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
- /*
- * If this is a string format name, then free the memory.
- */
- if ( information->is_string )
- _Workspace_Free( (void *)the_object->name.name_p );
- #endif
-
- /*
- * Clear out either format.
- */
- #if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
- the_object->name.name_p = NULL;
- #endif
+ _Assert( !information->is_string );
the_object->name.name_u32 = 0;
}
+
+void _Objects_Namespace_remove_string(
+ const Objects_Information *information,
+ Objects_Control *the_object
+)
+{
+ char *name;
+
+ _Assert( information->is_string );
+ name = RTEMS_DECONST( char *, the_object->name.name_p );
+ the_object->name.name_p = NULL;
+ _Workspace_Free( name );
+}
diff --git a/cpukit/score/src/objectnametoidstring.c b/cpukit/score/src/objectnametoidstring.c
index bd4b4a9ead..dd69f8a9ea 100644
--- a/cpukit/score/src/objectnametoidstring.c
+++ b/cpukit/score/src/objectnametoidstring.c
@@ -22,7 +22,6 @@
#include <string.h>
-#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
Objects_Control *_Objects_Get_by_name(
const Objects_Information *information,
const char *name,
@@ -72,4 +71,3 @@ Objects_Control *_Objects_Get_by_name(
*error = OBJECTS_GET_BY_NAME_NO_OBJECT;
return NULL;
}
-#endif
diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c
index c699570209..227de515ec 100644
--- a/cpukit/score/src/objectsetname.c
+++ b/cpukit/score/src/objectsetname.c
@@ -24,9 +24,9 @@
#include <string.h>
bool _Objects_Set_name(
- Objects_Information *information,
- Objects_Control *the_object,
- const char *name
+ const Objects_Information *information,
+ Objects_Control *the_object,
+ const char *name
)
{
size_t length;
@@ -35,7 +35,6 @@ bool _Objects_Set_name(
s = name;
length = strnlen( name, information->name_length );
-#if defined(RTEMS_SCORE_OBJECT_ENABLE_STRING_NAMES)
if ( information->is_string ) {
char *d;
@@ -49,16 +48,13 @@ bool _Objects_Set_name(
strncpy( d, name, length );
d[length] = '\0';
the_object->name.name_p = d;
- } else
-#endif
- {
+ } else {
the_object->name.name_u32 = _Objects_Build_name(
((length) ? s[ 0 ] : ' '),
((length > 1) ? s[ 1 ] : ' '),
((length > 2) ? s[ 2 ] : ' '),
((length > 3) ? s[ 3 ] : ' ')
);
-
}
return true;