mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2025-08-04 05:24:37 +08:00
Make lwip_cyclic_timers[] const
This commit is contained in:
parent
ca71eea56f
commit
fb75f48751
@ -68,7 +68,7 @@
|
|||||||
|
|
||||||
/** This array contains all stack-internal cyclic timers. To get the number of
|
/** This array contains all stack-internal cyclic timers. To get the number of
|
||||||
* timers, use LWIP_ARRAYSIZE() */
|
* timers, use LWIP_ARRAYSIZE() */
|
||||||
struct lwip_cyclic_timer lwip_cyclic_timers[] = {
|
const struct lwip_cyclic_timer lwip_cyclic_timers[] = {
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
/* The TCP timer is a special case: it does not have to run always and
|
/* The TCP timer is a special case: it does not have to run always and
|
||||||
is triggered to start from TCP using tcp_timer_needed() */
|
is triggered to start from TCP using tcp_timer_needed() */
|
||||||
@ -163,7 +163,7 @@ tcp_timer_needed(void)
|
|||||||
static void
|
static void
|
||||||
cyclic_timer(void *arg)
|
cyclic_timer(void *arg)
|
||||||
{
|
{
|
||||||
struct lwip_cyclic_timer* cyclic = (struct lwip_cyclic_timer*)arg;
|
const struct lwip_cyclic_timer* cyclic = (const struct lwip_cyclic_timer*)arg;
|
||||||
#if LWIP_DEBUG_TIMERNAMES
|
#if LWIP_DEBUG_TIMERNAMES
|
||||||
LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: %s()\n", cyclic->handler_name));
|
LWIP_DEBUGF(TIMERS_DEBUG, ("tcpip: %s()\n", cyclic->handler_name));
|
||||||
#endif
|
#endif
|
||||||
@ -177,7 +177,9 @@ void sys_timeouts_init(void)
|
|||||||
size_t i;
|
size_t i;
|
||||||
/* tcp_tmr() at index 0 is started on demand */
|
/* tcp_tmr() at index 0 is started on demand */
|
||||||
for (i = 1; i < LWIP_ARRAYSIZE(lwip_cyclic_timers); i++) {
|
for (i = 1; i < LWIP_ARRAYSIZE(lwip_cyclic_timers); i++) {
|
||||||
sys_timeout(lwip_cyclic_timers[i].interval_ms, cyclic_timer, &lwip_cyclic_timers[i]);
|
/* we have to cast via size_t to get rid of const warning
|
||||||
|
(this is OK as cyclic_timer() casts back to const* */
|
||||||
|
sys_timeout(lwip_cyclic_timers[i].interval_ms, cyclic_timer, (void*)(size_t)&lwip_cyclic_timers[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialise timestamp for sys_check_timeouts */
|
/* Initialise timestamp for sys_check_timeouts */
|
||||||
|
@ -81,7 +81,7 @@ struct lwip_cyclic_timer {
|
|||||||
|
|
||||||
/** This array contains all stack-internal cyclic timers. To get the number of
|
/** This array contains all stack-internal cyclic timers. To get the number of
|
||||||
* timers, use LWIP_ARRAYSIZE() */
|
* timers, use LWIP_ARRAYSIZE() */
|
||||||
extern struct lwip_cyclic_timer lwip_cyclic_timers[];
|
extern const struct lwip_cyclic_timer lwip_cyclic_timers[];
|
||||||
|
|
||||||
#if LWIP_TIMERS
|
#if LWIP_TIMERS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user