1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Minor optimisation: only inclued queueContains if it is required.

This commit is contained in:
Martin Budden 2016-01-20 16:23:57 +00:00 committed by borisbstyle
parent b22610b9e5
commit 3d403fed8f

View file

@ -49,8 +49,11 @@ uint16_t averageSystemLoadPercent = 0;
static int taskQueuePos = 0;
static int taskQueueSize = 0;
// No need for a linked list for the queue, since items are only inserted at startup
#ifdef UNIT_TEST
STATIC_UNIT_TESTED cfTask_t* taskQueueArray[TASK_COUNT + 1]; // 1 extra space so test code can check for buffer overruns
#else
static cfTask_t* taskQueueArray[TASK_COUNT];
#endif
STATIC_UNIT_TESTED void queueClear(void)
{
memset(taskQueueArray, 0, (int)(sizeof(taskQueueArray)));
@ -65,6 +68,7 @@ STATIC_UNIT_TESTED int queueSize(void)
}
#endif
#if !defined(SKIP_TASK_STATISTICS) || defined(UNIT_TEST)
STATIC_UNIT_TESTED bool queueContains(cfTask_t *task)
{
for (int ii = 0; ii < taskQueueSize; ++ii) {
@ -74,6 +78,7 @@ STATIC_UNIT_TESTED bool queueContains(cfTask_t *task)
}
return false;
}
#endif
STATIC_UNIT_TESTED void queueAdd(cfTask_t *task)
{