npppd: remove redundant evtimer_del in FSM macro

Bjorn Ketelaars <[email protected]> Thu, 6 Aug 2026 13:27:26 +0200
Newsgroups gmane.os.openbsd.tech
Message-ID <[email protected]>
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."

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?

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);			\
 	}