]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: don't allocate a new string in snprintf
authorDavid du Colombier <0intro@gmail.com>
Tue, 2 Sep 2014 22:56:50 +0000 (00:56 +0200)
committerDavid du Colombier <0intro@gmail.com>
Tue, 2 Sep 2014 22:56:50 +0000 (00:56 +0200)
This fixes the Plan 9 build.

Fix issue 8621.

LGTM=iant
R=rsc, mattn.jp, iant
CC=golang-codereviews
https://golang.org/cl/135280043

src/pkg/runtime/print1.go

index 28faa7cbbb464f0d65f196f7c3a1f1b1ae010b6a..93f83ed26fe24ee34b546289fe3c24b740cd178f 100644 (file)
@@ -54,7 +54,7 @@ func snprintf(dst *byte, n int32, s *byte) {
 
        gp := getg()
        gp.writebuf = buf[0:0 : n-1] // leave room for NUL, this is called from C
-       vprintf(gostring(s), add(unsafe.Pointer(&s), unsafe.Sizeof(s)))
+       vprintf(gostringnocopy(s), add(unsafe.Pointer(&s), unsafe.Sizeof(s)))
        buf[len(gp.writebuf)] = '\x00'
        gp.writebuf = nil
 }