From: David Crawshaw Date: Thu, 18 Feb 2016 16:08:25 +0000 (-0500) Subject: cmd/compile: remove NUL-terminator from string data X-Git-Tag: go1.7beta1~1559 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=08c2cd84699e0aa0e9dbcfbd5f4ca89df40484f5;p=gostls13.git cmd/compile: remove NUL-terminator from string data Makes godoc 37KB smaller. For #6853. Change-Id: I0bd6e40f2b4da193768a9fc2ce494cacf7e83c32 Reviewed-on: https://go-review.googlesource.com/19697 Run-TryBot: David Crawshaw TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- diff --git a/src/cmd/compile/internal/gc/obj.go b/src/cmd/compile/internal/gc/obj.go index 0a96da61fa..52f3354227 100644 --- a/src/cmd/compile/internal/gc/obj.go +++ b/src/cmd/compile/internal/gc/obj.go @@ -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 diff --git a/src/cmd/link/internal/ld/decodesym.go b/src/cmd/link/internal/ld/decodesym.go index 52eb46bb5c..ec3a9b5613 100644 --- a/src/cmd/link/internal/ld/decodesym.go +++ b/src/cmd/link/internal/ld/decodesym.go @@ -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 {