Commit d8cbbe68 authored by David du Colombier's avatar David du Colombier

runtime: don't allocate a new string in snprintf

This fixes the Plan 9 build.

Fix issue 8621.

LGTM=iant
R=rsc, mattn.jp, iant
CC=golang-codereviews
https://golang.org/cl/135280043
parent b3f224b2
...@@ -54,7 +54,7 @@ func snprintf(dst *byte, n int32, s *byte) { ...@@ -54,7 +54,7 @@ func snprintf(dst *byte, n int32, s *byte) {
gp := getg() gp := getg()
gp.writebuf = buf[0:0 : n-1] // leave room for NUL, this is called from C 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' buf[len(gp.writebuf)] = '\x00'
gp.writebuf = nil gp.writebuf = nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment