Skip to content

Commit 49acd53

Browse files
committed
unix: switch (*CPUSet).Zero to clear builtin
clear was added to Go 1.21 and is better than the manual loop approach. Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
1 parent 543f21a commit 49acd53

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

unix/affinity_linux.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ func SchedSetaffinity(pid int, set *CPUSet) error {
3838

3939
// Zero clears the set s, so that it contains no CPUs.
4040
func (s *CPUSet) Zero() {
41-
for i := range s {
42-
s[i] = 0
43-
}
41+
clear(*s)
4442
}
4543

4644
func cpuBitsIndex(cpu int) int {

0 commit comments

Comments
 (0)