aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/traceback.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2019-03-05 20:44:29 +0000
committerDaniel Martí <mvdan@mvdan.cc>2019-03-08 14:29:19 +0000
commit49662bc6b02810389c66b6b24576f6a5b217d471 (patch)
tree15769762bf84bad2b9f1a4a1181845a5ad0673f5 /src/runtime/traceback.go
parentce7534ff06df5b3148aa325deedcb94ac5b30ec0 (diff)
downloadgo-49662bc6b02810389c66b6b24576f6a5b217d471.tar.gz
go-49662bc6b02810389c66b6b24576f6a5b217d471.zip
all: simplify multiple for loops
If a for loop has a simple condition and begins with a simple "if x { break; }"; we can simply add "!x" to the loop's condition. While at it, simplify a few assignments to use the common pattern "x := staticDefault; if cond { x = otherValue(); }". Finally, simplify a couple of var declarations. Change-Id: I413982c6abd32905adc85a9a666cb3819139c19f Reviewed-on: https://go-review.googlesource.com/c/go/+/165342 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/traceback.go')
-rw-r--r--src/runtime/traceback.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/runtime/traceback.go b/src/runtime/traceback.go
index a536fb2a716..0bb7fc2831c 100644
--- a/src/runtime/traceback.go
+++ b/src/runtime/traceback.go
@@ -1289,10 +1289,7 @@ func printCgoTraceback(callers *cgoCallers) {
func printOneCgoTraceback(pc uintptr, max int, arg *cgoSymbolizerArg) int {
c := 0
arg.pc = pc
- for {
- if c > max {
- break
- }
+ for c <= max {
callCgoSymbolizer(arg)
if arg.funcName != nil {
// Note that we don't print any argument