mirror of
https://github.com/golang/go
synced 2024-11-18 22:14:56 -07:00
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
This commit is contained in:
parent
b3f224b280
commit
d8cbbe6802
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user