From 9d35412ac8338500f0321a007e0074c01b4a9f21 Mon Sep 17 00:00:00 2001 From: Zsolt Felfoldi Date: Wed, 16 Apr 2025 11:04:24 +0200 Subject: [PATCH] core/filtermaps: use slices.Clone to copy filter maps --- core/filtermaps/filtermaps.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/core/filtermaps/filtermaps.go b/core/filtermaps/filtermaps.go index 1d6bb75c18..fa2d6e3ffb 100644 --- a/core/filtermaps/filtermaps.go +++ b/core/filtermaps/filtermaps.go @@ -147,9 +147,7 @@ type filterMap []FilterRow // copies of the same map would result in data corruption, therefore a fast copy // should always be used in a read only way. func (fm filterMap) fastCopy() filterMap { - c := make(filterMap, len(fm)) - copy(c, fm) - return c + return slices.Clone(fm) } // fullCopy returns a copy of the given filter map, also making a copy of each @@ -158,8 +156,7 @@ func (fm filterMap) fastCopy() filterMap { func (fm filterMap) fullCopy() filterMap { c := make(filterMap, len(fm)) for i, row := range fm { - c[i] = make(FilterRow, len(row)) - copy(c[i], row) + c[i] = slices.Clone(row) } return c }