Skip to content

Commit 7af592a

Browse files
committed
[timer] With macro compilation, some code is no longer executed when RT_TIMER_SKIP_LIST_LEVEL=1
1 parent 75f4172 commit 7af592a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/timer.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2022, RT-Thread Development Team
2+
* Copyright (c) 2006-2024, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -442,8 +442,10 @@ static rt_err_t _timer_start(rt_list_t *timer_list, rt_timer_t timer)
442442
break;
443443
}
444444
}
445+
#if (RT_TIMER_SKIP_LIST_LEVEL > 1)
445446
if (row_lvl != RT_TIMER_SKIP_LIST_LEVEL - 1)
446447
row_head[row_lvl + 1] = row_head[row_lvl] + 1;
448+
#endif /* RT_TIMER_SKIP_LIST_LEVEL > 1 */
447449
}
448450

449451
/* Interestingly, this super simple timer insert counter works very very
@@ -455,6 +457,7 @@ static rt_err_t _timer_start(rt_list_t *timer_list, rt_timer_t timer)
455457

456458
rt_list_insert_after(row_head[RT_TIMER_SKIP_LIST_LEVEL - 1],
457459
&(timer->row[RT_TIMER_SKIP_LIST_LEVEL - 1]));
460+
#if (RT_TIMER_SKIP_LIST_LEVEL > 1)
458461
for (row_lvl = 2; row_lvl <= RT_TIMER_SKIP_LIST_LEVEL; row_lvl++)
459462
{
460463
if (!(tst_nr & RT_TIMER_SKIP_LIST_MASK))
@@ -466,6 +469,7 @@ static rt_err_t _timer_start(rt_list_t *timer_list, rt_timer_t timer)
466469
* bits. */
467470
tst_nr >>= (RT_TIMER_SKIP_LIST_MASK + 1) >> 1;
468471
}
472+
#endif /* RT_TIMER_SKIP_LIST_LEVEL > 1 */
469473

470474
timer->parent.flag |= RT_TIMER_FLAG_ACTIVATED;
471475

0 commit comments

Comments
 (0)