summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/slice.c
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2009-12-07 15:51:58 -0800
committerRuss Cox <rsc@golang.org>2009-12-07 15:51:58 -0800
commit2f60e7196845b32ec04e8428367562e0155dee78 (patch)
treefe649ba45f677c9db58b27dbfa5b4d556285cc6a /src/pkg/runtime/slice.c
parente140e8f6198a254d167f0ec9f27abb19567b6756 (diff)
downloadgolang-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.c5
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);