static FleetProvisioningStatus_t consumeTemplateName()

in source/fleet_provisioning.c [607:635]


static FleetProvisioningStatus_t consumeTemplateName( const char ** pTopicCursor,
                                                      uint16_t * pRemainingLength )
{
    FleetProvisioningStatus_t ret = FleetProvisioningNoMatch;
    uint16_t i = 0U;

    assert( pTopicCursor != NULL );
    assert( *pTopicCursor != NULL );
    assert( pRemainingLength != NULL );

    /* Find the first forward slash. It marks the end of the template name. */
    for( i = 0U; i < *pRemainingLength; i++ )
    {
        if( ( *pTopicCursor )[ i ] == '/' )
        {
            break;
        }
    }

    /* Zero length template name is not valid. */
    if( i > 0U )
    {
        ret = FleetProvisioningSuccess;
        *pTopicCursor += i;
        *pRemainingLength -= i;
    }

    return ret;
}