/* Function updating 'num_configured_slots' and 'slots_configured' properties of slot registry when slot is being cleared.  */
static void configured_slots_on_clear_update(uint8_t *p_configured, uint8_t *p_num_configured_slots, uint8_t slot_no)
/* Function updating 'num_configured_slots' and 'slots_configured' properties of slot registry when slot is being cleared.  */
static void configured_slots_on_clear_update(uint8_t *p_configured, uint8_t *p_num_configured_slots, uint8_t slot_no)
{
    uint8_t index_of_last_configured_slot = *p_num_configured_slots - 1;
    for (uint32_t i = 0; i < APP_MAX_ADV_SLOTS; ++i)
    {
        if (p_configured[i] == slot_no)
        {
            if (i < index_of_last_configured_slot)
            {
                for (uint32_t j = i; j < index_of_last_configured_slot; ++j)
                {
                    p_configured[j] = p_configured[j + 1];
                }
                memset(&p_configured[index_of_last_configured_slot],
                       ES_SLOT_NOT_CONFIGURED,
                       APP_MAX_ADV_SLOTS - index_of_last_configured_slot);
            }
            else
            {
                p_configured[i] = ES_SLOT_NOT_CONFIGURED;
            }
            *p_num_configured_slots -= 1;
            return;
        }
    }
}