]> Cypherpunks repositories - gostls13.git/commitdiff
cgo: fix index-out-of-bounds bug
authorRobert Griesemer <gri@golang.org>
Fri, 18 Mar 2011 19:38:38 +0000 (12:38 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 18 Mar 2011 19:38:38 +0000 (12:38 -0700)
R=rsc
CC=golang-dev
https://golang.org/cl/4284057

src/cmd/cgo/ast.go

index d49e4b4bba1336047fadaa3681b1d99986f3e0c5..f5d884eafd1405ceefd3bc2aaf4fb891e4677813 100644 (file)
@@ -180,7 +180,7 @@ func (f *File) saveExport(x interface{}, context string) {
                return
        }
        for _, c := range n.Doc.List {
-               if string(c.Text[0:9]) != "//export " {
+               if !strings.HasPrefix(string(c.Text), "//export ") {
                        continue
                }