diff options
author | Keith Randall <khr@golang.org> | 2016-04-19 19:35:10 -0700 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2016-04-20 14:02:22 +0000 |
commit | 001e8e8070e8ed3a578dbad93cc3f70257e965bd (patch) | |
tree | 13300d3f022b1d24571be6c267979e5d8d0c48e5 /src/runtime/string.go | |
parent | 731531980a36f1fa6434c947c54daf8ba530a65f (diff) | |
download | go-001e8e8070e8ed3a578dbad93cc3f70257e965bd.tar.gz go-001e8e8070e8ed3a578dbad93cc3f70257e965bd.zip |
runtime: simplify mallocgc flag argument
mallocgc can calculate noscan itself. The only remaining
flag argument is needzero, so we just make that a boolean arg.
Fixes #15379
Change-Id: I839a70790b2a0c9dbcee2600052bfbd6c8148e20
Reviewed-on: https://go-review.googlesource.com/22290
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r-- | src/runtime/string.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go index 2d20e0a9c3..112ce5d588 100644 --- a/src/runtime/string.go +++ b/src/runtime/string.go @@ -284,7 +284,7 @@ func stringiter2(s string, k int) (int, rune) { // The storage is not zeroed. Callers should use // b to set the string contents and then drop b. func rawstring(size int) (s string, b []byte) { - p := mallocgc(uintptr(size), nil, flagNoScan|flagNoZero) + p := mallocgc(uintptr(size), nil, false) stringStructOf(&s).str = p stringStructOf(&s).len = size @@ -302,7 +302,7 @@ func rawstring(size int) (s string, b []byte) { // rawbyteslice allocates a new byte slice. The byte slice is not zeroed. func rawbyteslice(size int) (b []byte) { cap := roundupsize(uintptr(size)) - p := mallocgc(cap, nil, flagNoScan|flagNoZero) + p := mallocgc(cap, nil, false) if cap != uintptr(size) { memclr(add(p, uintptr(size)), cap-uintptr(size)) } @@ -317,7 +317,7 @@ func rawruneslice(size int) (b []rune) { throw("out of memory") } mem := roundupsize(uintptr(size) * 4) - p := mallocgc(mem, nil, flagNoScan|flagNoZero) + p := mallocgc(mem, nil, false) if mem != uintptr(size)*4 { memclr(add(p, uintptr(size)*4), mem-uintptr(size)*4) } |