Re: npppd: remove redundant evtimer_del in FSM macro
YASUOKA Masahiko <[email protected]>
| Newsgroups | gmane.os.openbsd.tech |
|---|---|
| Message-ID | <[email protected]> |
Hi,
In event(3):
The function event_add() schedules the execution of the ev event
....
(snip)
If the event in the ev argument already has a
scheduled timeout, the old timeout will be replaced by the new one.
so,
On Thu, 6 Aug 2026 13:27:26 +0200
Bjorn Ketelaars <[email protected]> wrote:
> While reading event_add(3), I noticed: "If the event in the ev argument
> already has a scheduled timeout, the old timeout will be replaced by the
> new one."
this behavior is documented as well?
> I grepped base for calls to evtimer_del() immediately before
> evtimer_add() and found a redundant deletion inside an npppd FSM macro.
> Since evtimer_add() handles pending timeouts internally, this extra call
> can be removed.
>
> OK?
ok yasuoka
>
> diff --git usr.sbin/npppd/npppd/fsm.h usr.sbin/npppd/npppd/fsm.h
> index 8fea751ceee..7b35ec60fb4 100644
> --- usr.sbin/npppd/npppd/fsm.h
> +++ usr.sbin/npppd/npppd/fsm.h
> @@ -141,7 +141,6 @@ typedef struct fsm_callbacks {
> evtimer_set(&(f)->timerctx.ev, fsm_evtimer_timeout,\
> &(f)->timerctx); \
> (f)->timerctx.func = fn; \
> - evtimer_del(&(f)->timerctx.ev); \
> evtimer_add(&(f)->timerctx.ev, &tv0); \
> }
>
>
>