mirror of
https://github.com/containers/podman.git
synced 2026-03-13 08:01:19 +08:00
fix new lint issues from prealloc
Fix a few new issues reported by the linter update. There is no need to copy the capAdd/capDrop slice in the compat create endpoint as they are only read and not modified. For the other code preallocate the slices so we safe memory allocations. Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
@@ -62,7 +62,6 @@ func GetDefaultDevices(mc *vmconfigs.MachineConfig) ([]vfConfig.VirtioDevice, *d
|
||||
}
|
||||
|
||||
func GetDebugDevices() ([]vfConfig.VirtioDevice, error) {
|
||||
var devices []vfConfig.VirtioDevice
|
||||
gpu, err := vfConfig.VirtioGPUNew()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -75,7 +74,7 @@ func GetDebugDevices() ([]vfConfig.VirtioDevice, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return append(devices, gpu, mouse, kb), nil
|
||||
return []vfConfig.VirtioDevice{gpu, mouse, kb}, nil
|
||||
}
|
||||
|
||||
func GetIgnitionVsockDevice(path string) (vfConfig.VirtioDevice, error) {
|
||||
|
||||
@@ -28,7 +28,8 @@ type QemuCmd []string
|
||||
// starting with the qemu binary, architecture specific options, and propagated
|
||||
// proxy and SSL settings
|
||||
func NewQemuBuilder(binary string, options []string) QemuCmd {
|
||||
q := QemuCmd{binary}
|
||||
q := make(QemuCmd, 0, 1+len(options))
|
||||
q = append(q, binary)
|
||||
return append(q, options...)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user