aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mstats.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2017-06-13 10:33:24 -0400
committerAustin Clements <austin@google.com>2017-06-13 18:57:48 +0000
commit200d0cc1929daa6331b552989b43d186d410d983 (patch)
tree97087538c2c610acbd1fdfd80300a628ddc068d4 /src/runtime/mstats.go
parentb488073d514d06269eab561104c0dc5ff606c4ba (diff)
downloadgo-200d0cc1929daa6331b552989b43d186d410d983.tar.gz
go-200d0cc1929daa6331b552989b43d186d410d983.zip
runtime: clean up some silly allp loops
Back in the day, allp was just a pointer to an array. As a result, the runtime has a few loops of the form: for i := 0; ; i++ { p := allp[i] if p == nil { break } ... } This is silly now because it requires that allp be one longer than the maximum possible number of Ps, but now that allp is in Go it has a length. Replace these with range loops. Change-Id: I91ef4bc7bd3c9d4fda2264f4aa1b1d0271d7f578 Reviewed-on: https://go-review.googlesource.com/45571 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/mstats.go')
-rw-r--r--src/runtime/mstats.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/runtime/mstats.go b/src/runtime/mstats.go
index 849e01860b..1cb44a15dd 100644
--- a/src/runtime/mstats.go
+++ b/src/runtime/mstats.go
@@ -591,8 +591,7 @@ func updatememstats() {
//go:nowritebarrier
func cachestats() {
- for i := 0; ; i++ {
- p := allp[i]
+ for _, p := range &allp {
if p == nil {
break
}