]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove NUL-terminator from string data
authorDavid Crawshaw <crawshaw@golang.org>
Thu, 18 Feb 2016 16:08:25 +0000 (11:08 -0500)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 4 Mar 2016 15:16:31 +0000 (15:16 +0000)
Makes godoc 37KB smaller.
For #6853.

Change-Id: I0bd6e40f2b4da193768a9fc2ce494cacf7e83c32
Reviewed-on: https://go-review.googlesource.com/19697
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/obj.go
src/cmd/link/internal/ld/decodesym.go

index 0a96da61fa4de721e6f7199b2094f4acb455da2b..52f3354227cdfcccd761ae8b69977a4575a03602 100644 (file)
@@ -233,7 +233,6 @@ func stringsym(s string) (hdr, data *Sym) {
                off = dsname(symdata, off, s[n:n+m])
        }
 
-       off = duint8(symdata, off, 0) // terminating NUL for runtime
        ggloblsym(symdata, int32(off), obj.DUPOK|obj.RODATA|obj.LOCAL)
 
        return symhdr, symdata
index 52eb46bb5c318f8b9b35889fb6cae102180f595d..ec3a9b56131be3f87c76ded0b61e074e9aa0150e 100644 (file)
@@ -217,7 +217,8 @@ func decodetype_structfieldname(s *LSym, i int) string {
        if r == nil {           // shouldn't happen.
                return ""
        }
-       return cstring(r.Sym.P[r.Add:])
+       strlen := int64(decode_inuxi(s.P[Thearch.Ptrsize:], Thearch.Intsize))
+       return string(r.Sym.P[r.Add : r.Add+strlen])
 }
 
 func decodetype_structfieldtype(s *LSym, i int) *LSym {