mirror of
https://github.com/golang/go
synced 2024-11-17 08:24:43 -07:00
cmd/internal/goobj: use unsafe.String in toString func
This commit is contained in:
parent
5b72f45dd1
commit
f0aa251dbb
@ -662,13 +662,7 @@ func toString(b []byte) string {
|
||||
if len(b) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
var s string
|
||||
hdr := (*unsafeheader.String)(unsafe.Pointer(&s))
|
||||
hdr.Data = unsafe.Pointer(&b[0])
|
||||
hdr.Len = len(b)
|
||||
|
||||
return s
|
||||
return unsafe.String(&b[0], len(b))
|
||||
}
|
||||
|
||||
func (r *Reader) StringRef(off uint32) string {
|
||||
|
Loading…
Reference in New Issue
Block a user