mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-26 07:22:20 +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 {
|
func (clh *cloudHypervisor) getPids() []int {
|
||||||
|
return []int{clh.state.PID}
|
||||||
var pids []int
|
|
||||||
pids = append(pids, clh.state.PID)
|
|
||||||
|
|
||||||
return pids
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (clh *cloudHypervisor) getVirtioFsPid() *int {
|
func (clh *cloudHypervisor) getVirtioFsPid() *int {
|
||||||
|
@ -2280,8 +2280,7 @@ func (q *qemu) getPids() []int {
|
|||||||
return []int{0}
|
return []int{0}
|
||||||
}
|
}
|
||||||
|
|
||||||
var pids []int
|
pids := []int{pid}
|
||||||
pids = append(pids, pid)
|
|
||||||
if q.state.VirtiofsdPid != 0 {
|
if q.state.VirtiofsdPid != 0 {
|
||||||
pids = append(pids, q.state.VirtiofsdPid)
|
pids = append(pids, q.state.VirtiofsdPid)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user