diff options
Diffstat (limited to 'src/pkg/runtime/slice.c')
-rw-r--r-- | src/pkg/runtime/slice.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/pkg/runtime/slice.c b/src/pkg/runtime/slice.c index 354c54c865..dd92a59a9d 100644 --- a/src/pkg/runtime/slice.c +++ b/src/pkg/runtime/slice.c @@ -48,27 +48,9 @@ uintptr runtime·zerobase; static void makeslice1(SliceType *t, intgo len, intgo cap, Slice *ret) { - uintptr size; - - size = cap*t->elem->size; - ret->len = len; ret->cap = cap; - - if(size == 0) - ret->array = (byte*)&runtime·zerobase; - else if((t->elem->kind&KindNoPointers)) - ret->array = runtime·mallocgc(size, FlagNoPointers, 1, 1); - else { - ret->array = runtime·mallocgc(size, 0, 1, 1); - - if(UseSpanType) { - if(false) { - runtime·printf("new slice [%D]%S: %p\n", (int64)cap, *t->elem->string, ret->array); - } - runtime·settype(ret->array, (uintptr)t->elem | TypeInfo_Array); - } - } + ret->array = runtime·cnewarray(t->elem, cap); } // appendslice(type *Type, x, y, []T) []T |