Skip to content

Commit 8b95f11

Browse files
committed
Add configASSERTs to alert when invalid parameters are passed into Queue Registry related functions.
Add a configASSERT when a queue is added to a QueueRegistry that is already full.
1 parent 030e590 commit 8b95f11

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

queue.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2725,6 +2725,9 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
27252725
{
27262726
UBaseType_t ux;
27272727

2728+
configASSERT( xQueue );
2729+
configASSERT( pcQueueName );
2730+
27282731
/* See if there is an empty space in the registry. A NULL name denotes
27292732
* a free slot. */
27302733
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
@@ -2743,6 +2746,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
27432746
mtCOVERAGE_TEST_MARKER();
27442747
}
27452748
}
2749+
/* Assert that the queue was added successfully */
2750+
configASSERT( ( ux != configQUEUE_REGISTRY_SIZE ) );
27462751
}
27472752

27482753
#endif /* configQUEUE_REGISTRY_SIZE */
@@ -2755,6 +2760,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
27552760
UBaseType_t ux;
27562761
const char * pcReturn = NULL; /*lint !e971 Unqualified char types are allowed for strings and single characters only. */
27572762

2763+
configASSERT( xQueue );
2764+
27582765
/* Note there is nothing here to protect against another task adding or
27592766
* removing entries from the registry while it is being searched. */
27602767

@@ -2783,6 +2790,8 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
27832790
{
27842791
UBaseType_t ux;
27852792

2793+
configASSERT( xQueue );
2794+
27862795
/* See if the handle of the queue being unregistered in actually in the
27872796
* registry. */
27882797
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )

0 commit comments

Comments
 (0)