preallocate paths in SetupRootless

Just a minor improvement as we know the size needed for the slice we can
allocate it only once instead of the append having to resize it.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2025-11-25 13:58:41 +01:00
parent ed9d298fb4
commit 4833357c72

View File

@@ -83,7 +83,7 @@ func (ic *ContainerEngine) SetupRootless(_ context.Context, noMoveProcess bool,
return err return err
} }
paths := []string{} paths := make([]string, 0, len(ctrs))
for _, ctr := range ctrs { for _, ctr := range ctrs {
paths = append(paths, ctr.ConfigNoCopy().ConmonPidFile) paths = append(paths, ctr.ConfigNoCopy().ConmonPidFile)
} }