mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
runtime: Optimize the way slice created
Initialize and assign a value, reducing one append operation Fixes: #2264 Signed-off-by: Binbin Zhang <binbin36520@gmail.com>
This commit is contained in:
parent
fb583780f6
commit
ff37f5c798
@ -742,11 +742,7 @@ func (clh *cloudHypervisor) check() error {
|
||||
}
|
||||
|
||||
func (clh *cloudHypervisor) getPids() []int {
|
||||
|
||||
var pids []int
|
||||
pids = append(pids, clh.state.PID)
|
||||
|
||||
return pids
|
||||
return []int{clh.state.PID}
|
||||
}
|
||||
|
||||
func (clh *cloudHypervisor) getVirtioFsPid() *int {
|
||||
|
@ -2280,8 +2280,7 @@ func (q *qemu) getPids() []int {
|
||||
return []int{0}
|
||||
}
|
||||
|
||||
var pids []int
|
||||
pids = append(pids, pid)
|
||||
pids := []int{pid}
|
||||
if q.state.VirtiofsdPid != 0 {
|
||||
pids = append(pids, q.state.VirtiofsdPid)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user