mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
common/helpers: use Modify() for subnet maps as well
Replace `table.Update()` with `table.Modify()`.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user