Skip to content

Commit

Permalink
Replace configASSERT( pcQueueName ) in vQueueAddToRegistry with a NUL…
Browse files Browse the repository at this point in the history
…L pointer check. (#313)

* Replace configASSERT( pcQueueName ) in vQueueAddToRegistry with a NULL pointer check.

Fixes #311

* Make NULL checks consistent.
paulbartell authored Apr 17, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 99295c9 commit 46f7feb
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions queue.c
Original file line number Diff line number Diff line change
@@ -2728,32 +2728,34 @@ BaseType_t xQueueIsQueueFullFromISR( const QueueHandle_t xQueue )
UBaseType_t ux;

configASSERT( xQueue );
configASSERT( pcQueueName );

QueueRegistryItem_t * pxEntryToWrite = NULL;

/* See if there is an empty space in the registry. A NULL name denotes
* a free slot. */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
if( pcQueueName != NULL )
{
/* Replace an existing entry if the queue is already in the registry. */
if( xQueueRegistry[ ux ].xHandle == xQueue )
{
pxEntryToWrite = &( xQueueRegistry[ ux ] );
break;
}
/* Otherwise, store in the next empty location */
else if( ( NULL == pxEntryToWrite ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) )
/* See if there is an empty space in the registry. A NULL name denotes
* a free slot. */
for( ux = ( UBaseType_t ) 0U; ux < ( UBaseType_t ) configQUEUE_REGISTRY_SIZE; ux++ )
{
pxEntryToWrite = &( xQueueRegistry[ ux ] );
}
else
{
mtCOVERAGE_TEST_MARKER();
/* Replace an existing entry if the queue is already in the registry. */
if( xQueue == xQueueRegistry[ ux ].xHandle )
{
pxEntryToWrite = &( xQueueRegistry[ ux ] );
break;
}
/* Otherwise, store in the next empty location */
else if( ( pxEntryToWrite == NULL ) && ( xQueueRegistry[ ux ].pcQueueName == NULL ) )
{
pxEntryToWrite = &( xQueueRegistry[ ux ] );
}
else
{
mtCOVERAGE_TEST_MARKER();
}
}
}

if( NULL != pxEntryToWrite )
if( pxEntryToWrite == NULL )
{
/* Store the information on this queue. */
pxEntryToWrite->pcQueueName = pcQueueName;

0 comments on commit 46f7feb

Please sign in to comment.