diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-23 10:33:51 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2020-09-28 06:19:52 +0200 |
commit | 69b4fe592fb26f3421add3c564677d78022bcf5a (patch) | |
tree | c77f799fdd0fc92795b98820009896c35b3dde97 /cpukit/score/src/coremsg.c | |
parent | score: Improve _CORE_message_queue_Initialize() (diff) | |
download | rtems-69b4fe592fb26f3421add3c564677d78022bcf5a.tar.bz2 |
score: Simplify CORE_message_queue_Buffer
Merge CORE_message_queue_Buffer structure into
CORE_message_queue_Buffer_control.
Use a zero-length array for the actual message buffer. This reduces the
structure size on all targets.
Update #4007.
Diffstat (limited to 'cpukit/score/src/coremsg.c')
-rw-r--r-- | cpukit/score/src/coremsg.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cpukit/score/src/coremsg.c b/cpukit/score/src/coremsg.c index c86f2c28e2..f7caca1ebf 100644 --- a/cpukit/score/src/coremsg.c +++ b/cpukit/score/src/coremsg.c @@ -23,8 +23,13 @@ #include <rtems/score/wkspace.h> #define MESSAGE_SIZE_LIMIT \ - ( SIZE_MAX - sizeof( uintptr_t ) + 1 \ - - sizeof( CORE_message_queue_Buffer_control ) ) + ( SIZE_MAX - sizeof( uintptr_t ) + 1 - sizeof( CORE_message_queue_Buffer ) ) + +RTEMS_STATIC_ASSERT( + offsetof( CORE_message_queue_Buffer, buffer ) + == sizeof( CORE_message_queue_Buffer ), + CORE_MESSAGE_QUEUE_BUFFER_OFFSET +); Status_Control _CORE_message_queue_Initialize( CORE_message_queue_Control *the_message_queue, @@ -43,8 +48,8 @@ Status_Control _CORE_message_queue_Initialize( buffer_size = RTEMS_ALIGN_UP( maximum_message_size, sizeof( uintptr_t ) ); _Assert( buffer_size >= maximum_message_size ); - buffer_size += sizeof( CORE_message_queue_Buffer_control ); - _Assert( buffer_size >= sizeof( CORE_message_queue_Buffer_control ) ); + buffer_size += sizeof( CORE_message_queue_Buffer ); + _Assert( buffer_size >= sizeof( CORE_message_queue_Buffer ) ); /* Make sure the memory allocation size computation does not overflow */ if ( maximum_pending_messages > SIZE_MAX / buffer_size ) { |