common/helpers: use Modify() for subnet maps as well

Replace `table.Update()` with `table.Modify()`.
This commit is contained in:
Vincent Bernat
2025-09-02 07:54:16 +02:00
parent c2c33709a0
commit e21e612259

View File

@@ -71,7 +71,10 @@ func (sm *SubnetMap[V]) Update(prefix netip.Prefix, cb func(V, bool) V) {
if sm.table == nil {
sm.table = &bart.Table[V]{}
}
sm.table.Update(prefix, cb)
sm.table.Modify(prefix, func(oldValue V, found bool) (V, bool) {
newValue := cb(oldValue, found)
return newValue, false
})
}
// All walks the whole subnet map.