aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2017-08-21 22:23:14 +0200
committerDaniel Martí <mvdan@mvdan.cc>2017-08-29 20:57:41 +0000
commitfbc8973a6bc88b50509ea738f475b36ef756bf90 (patch)
treebec33b02e805593213b72d9908443131af909fe0 /src/runtime
parent305fd9179d2199cd1bb64402405857d2f2d02478 (diff)
downloadgo-fbc8973a6bc88b50509ea738f475b36ef756bf90.tar.xz
all: join some chained ifs to unindent code
Found with mvdan.cc/unindent. It skipped the cases where parentheses would need to be added, where comments would have to be moved elsewhere, or where actions and simple logic would mix. One of them was of the form "err != nil && err == io.EOF", so the first part was removed. Change-Id: Ie504c2b03a2c87d10ecbca1b9270069be1171b91 Reviewed-on: https://go-review.googlesource.com/57690 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/cgocall.go6
-rw-r--r--src/runtime/proc.go12
-rw-r--r--src/runtime/select.go6
3 files changed, 9 insertions, 15 deletions
diff --git a/src/runtime/cgocall.go b/src/runtime/cgocall.go
index 755269ebd2..ce4d707e06 100644
--- a/src/runtime/cgocall.go
+++ b/src/runtime/cgocall.go
@@ -580,10 +580,8 @@ func cgoCheckUnknownPointer(p unsafe.Pointer, msg string) (base, i uintptr) {
// No more possible pointers.
break
}
- if hbits.isPointer() {
- if cgoIsGoPointer(*(*unsafe.Pointer)(unsafe.Pointer(base + i))) {
- panic(errorString(msg))
- }
+ if hbits.isPointer() && cgoIsGoPointer(*(*unsafe.Pointer)(unsafe.Pointer(base + i))) {
+ panic(errorString(msg))
}
hbits = hbits.next()
}
diff --git a/src/runtime/proc.go b/src/runtime/proc.go
index cf2537c812..06abdf2a9b 100644
--- a/src/runtime/proc.go
+++ b/src/runtime/proc.go
@@ -3568,13 +3568,11 @@ func procresize(nprocs int32) *p {
// free unused P's
for i := nprocs; i < old; i++ {
p := allp[i]
- if trace.enabled {
- if p == getg().m.p.ptr() {
- // moving to p[0], pretend that we were descheduled
- // and then scheduled again to keep the trace sane.
- traceGoSched()
- traceProcStop(p)
- }
+ if trace.enabled && p == getg().m.p.ptr() {
+ // moving to p[0], pretend that we were descheduled
+ // and then scheduled again to keep the trace sane.
+ traceGoSched()
+ traceProcStop(p)
}
// move all runnable goroutines to the global queue
for p.runqhead != p.runqtail {
diff --git a/src/runtime/select.go b/src/runtime/select.go
index bf3a550ea4..a623735865 100644
--- a/src/runtime/select.go
+++ b/src/runtime/select.go
@@ -457,10 +457,8 @@ loop:
print("wait-return: sel=", sel, " c=", c, " cas=", cas, " kind=", cas.kind, "\n")
}
- if cas.kind == caseRecv {
- if cas.receivedp != nil {
- *cas.receivedp = true
- }
+ if cas.kind == caseRecv && cas.receivedp != nil {
+ *cas.receivedp = true
}
if raceenabled {