Skip to content

Commit 46f7feb

Browse files
authored
Replace configASSERT( pcQueueName ) in vQueueAddToRegistry with a NULL pointer check. (#313)
* Replace configASSERT( pcQueueName ) in vQueueAddToRegistry with a NULL pointer check. Fixes #311 * Make NULL checks consistent.
1 parent 99295c9 commit 46f7feb

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

queue.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,32 +2728,34 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
27282728
UBaseType_t ux;
27292729

27302730
configASSERT( xQueue );
2731-
configASSERT( pcQueueName );
27322731

27332732
QueueRegistryItem_t * pxEntryToWrite = NULL;
27342733

2735-
/* See if there is an empty space in the registry. A NULL name denotes
2736-
* a free slot. */
2737-
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
2734+
if( pcQueueName != NULL )
27382735
{
2739-
/* Replace an existing entry if the queue is already in the registry. */
2740-
if( xQueueRegistry[ ux ].xHandle == xQueue )
2741-
{
2742-
pxEntryToWrite = &( xQueueRegistry[ ux ] );
2743-
break;
2744-
}
2745-
/* Otherwise, store in the next empty location */
2746-
else if( ( NULL == pxEntryToWrite ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) )
2736+
/* See if there is an empty space in the registry. A NULL name denotes
2737+
* a free slot. */
2738+
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
27472739
{
2748-
pxEntryToWrite = &( xQueueRegistry[ ux ] );
2749-
}
2750-
else
2751-
{
2752-
mtCOVERAGE_TEST_MARKER();
2740+
/* Replace an existing entry if the queue is already in the registry. */
2741+
if( xQueue == xQueueRegistry[ ux ].xHandle )
2742+
{
2743+
pxEntryToWrite = &( xQueueRegistry[ ux ] );
2744+
break;
2745+
}
2746+
/* Otherwise, store in the next empty location */
2747+
else if( ( pxEntryToWrite == NULL ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) )
2748+
{
2749+
pxEntryToWrite = &( xQueueRegistry[ ux ] );
2750+
}
2751+
else
2752+
{
2753+
mtCOVERAGE_TEST_MARKER();
2754+
}
27532755
}
27542756
}
27552757

2756-
if( NULL != pxEntryToWrite )
2758+
if( pxEntryToWrite == NULL )
27572759
{
27582760
/* Store the information on this queue. */
27592761
pxEntryToWrite->pcQueueName = pcQueueName;

0 commit comments

Comments
 (0)