mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2026-10-09 23:53:04 -04:00
Add configASSERT to queue metadata accessor functions
uxQueueGetQueueNumber(), vQueueSetQueueNumber(), ucQueueGetQueueType(), uxQueueGetQueueItemSize(), and uxQueueGetQueueLength() dereference the queue handle without first checking that it is not NULL, unlike other public queue accessors such as uxQueueMessagesWaiting() and uxQueueSpacesAvailable(). This adds configASSERT( xQueue ) to each of these functions for consistency and to catch invalid handles in debug builds.
This commit is contained in:
parent
ce221a8bb4
commit
eafad297de
1 changed files with 10 additions and 0 deletions
10
queue.c
10
queue.c
|
|
@ -2308,6 +2308,8 @@ void vQueueDelete( QueueHandle_t xQueue )
|
|||
{
|
||||
traceENTER_uxQueueGetQueueNumber( xQueue );
|
||||
|
||||
configASSERT( xQueue );
|
||||
|
||||
traceRETURN_uxQueueGetQueueNumber( ( ( Queue_t * ) xQueue )->uxQueueNumber );
|
||||
|
||||
return ( ( Queue_t * ) xQueue )->uxQueueNumber;
|
||||
|
|
@ -2323,6 +2325,8 @@ void vQueueDelete( QueueHandle_t xQueue )
|
|||
{
|
||||
traceENTER_vQueueSetQueueNumber( xQueue, uxQueueNumber );
|
||||
|
||||
configASSERT( xQueue );
|
||||
|
||||
( ( Queue_t * ) xQueue )->uxQueueNumber = uxQueueNumber;
|
||||
|
||||
traceRETURN_vQueueSetQueueNumber();
|
||||
|
|
@ -2337,6 +2341,8 @@ void vQueueDelete( QueueHandle_t xQueue )
|
|||
{
|
||||
traceENTER_ucQueueGetQueueType( xQueue );
|
||||
|
||||
configASSERT( xQueue );
|
||||
|
||||
traceRETURN_ucQueueGetQueueType( ( ( Queue_t * ) xQueue )->ucQueueType );
|
||||
|
||||
return ( ( Queue_t * ) xQueue )->ucQueueType;
|
||||
|
|
@ -2349,6 +2355,8 @@ UBaseType_t uxQueueGetQueueItemSize( QueueHandle_t xQueue ) /* PRIVILEGED_FUNCTI
|
|||
{
|
||||
traceENTER_uxQueueGetQueueItemSize( xQueue );
|
||||
|
||||
configASSERT( xQueue );
|
||||
|
||||
traceRETURN_uxQueueGetQueueItemSize( ( ( Queue_t * ) xQueue )->uxItemSize );
|
||||
|
||||
return ( ( Queue_t * ) xQueue )->uxItemSize;
|
||||
|
|
@ -2359,6 +2367,8 @@ UBaseType_t uxQueueGetQueueLength( QueueHandle_t xQueue ) /* PRIVILEGED_FUNCTION
|
|||
{
|
||||
traceENTER_uxQueueGetQueueLength( xQueue );
|
||||
|
||||
configASSERT( xQueue );
|
||||
|
||||
traceRETURN_uxQueueGetQueueLength( ( ( Queue_t * ) xQueue )->uxLength );
|
||||
|
||||
return ( ( Queue_t * ) xQueue )->uxLength;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue