summaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-09 01:08:34 -0400
committerRuss Cox <rsc@golang.org>2014-09-09 01:08:34 -0400
commit58580c80576c0281a1af5dbc1592d19810ee7d4b (patch)
tree7f4e97a8bdc88e990ca283269fab5c6ddb689bcd /src/runtime/string.go
parent882621154ee94c92fe22ab7377df1b77cedd822a (diff)
downloadgo-58580c80576c0281a1af5dbc1592d19810ee7d4b.tar.gz
runtime: merge mallocgc, gomallocgc
I assumed they were the same when I wrote cgocallback.go earlier today. Merge them to eliminate confusion. I can't tell what gomallocgc did before with a nil type but without FlagNoScan. I created a call like that in cgocallback.go this morning, translating from a C file. It was supposed to do what the C version did, namely treat the block conservatively. Now it will. LGTM=khr R=khr CC=golang-codereviews https://codereview.appspot.com/141810043
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 99cce1326..c84f67342 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -192,7 +192,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 := gomallocgc(uintptr(size), nil, flagNoScan|flagNoZero)
+ p := mallocgc(uintptr(size), nil, flagNoScan|flagNoZero)
(*stringStruct)(unsafe.Pointer(&s)).str = p
(*stringStruct)(unsafe.Pointer(&s)).len = size
@@ -212,7 +212,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 := goroundupsize(uintptr(size))
- p := gomallocgc(cap, nil, flagNoScan|flagNoZero)
+ p := mallocgc(cap, nil, flagNoScan|flagNoZero)
if cap != uintptr(size) {
memclr(add(p, uintptr(size)), cap-uintptr(size))
}
@@ -229,7 +229,7 @@ func rawruneslice(size int) (b []rune) {
gothrow("out of memory")
}
mem := goroundupsize(uintptr(size) * 4)
- p := gomallocgc(mem, nil, flagNoScan|flagNoZero)
+ p := mallocgc(mem, nil, flagNoScan|flagNoZero)
if mem != uintptr(size)*4 {
memclr(add(p, uintptr(size)*4), mem-uintptr(size)*4)
}