diff options
| author | Russ Cox <rsc@golang.org> | 2009-12-07 15:51:58 -0800 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2009-12-07 15:51:58 -0800 |
| commit | 2f60e7196845b32ec04e8428367562e0155dee78 (patch) | |
| tree | fe649ba45f677c9db58b27dbfa5b4d556285cc6a /src/pkg/runtime/slice.c | |
| parent | e140e8f6198a254d167f0ec9f27abb19567b6756 (diff) | |
| download | golang-2f60e7196845b32ec04e8428367562e0155dee78.tar.gz | |
runtime: introduce unsafe.New and unsafe.NewArray
to provide functionality previously hacked in to
reflect and gob.
R=r
http://codereview.appspot.com/165076
Diffstat (limited to 'src/pkg/runtime/slice.c')
| -rw-r--r-- | src/pkg/runtime/slice.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/pkg/runtime/slice.c b/src/pkg/runtime/slice.c index 1d7a56e7b..4d5840c21 100644 --- a/src/pkg/runtime/slice.c +++ b/src/pkg/runtime/slice.c @@ -8,6 +8,7 @@ static int32 debug = 0; +// see also unsafe·NewArray // makeslice(typ *Type, nel int, cap int) (ary []any); void runtime·makeslice(SliceType *t, uint32 nel, uint32 cap, Slice ret) @@ -21,9 +22,7 @@ runtime·makeslice(SliceType *t, uint32 nel, uint32 cap, Slice ret) ret.len = nel; ret.cap = cap; - // TODO(rsc): Disabled because reflect and gob cast []byte - // to data structures with pointers. - if(0 && (t->elem->kind&KindNoPointers)) + if((t->elem->kind&KindNoPointers)) ret.array = mallocgc(size, RefNoPointers, 1); else ret.array = mal(size); |
