summaryrefslogtreecommitdiff
path: root/libgo/runtime/go-unsafe-newarray.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/go-unsafe-newarray.c')
-rw-r--r--libgo/runtime/go-unsafe-newarray.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/libgo/runtime/go-unsafe-newarray.c b/libgo/runtime/go-unsafe-newarray.c
index e4fb3366bd7..f5c5efce78c 100644
--- a/libgo/runtime/go-unsafe-newarray.c
+++ b/libgo/runtime/go-unsafe-newarray.c
@@ -21,21 +21,5 @@ void *unsafe_NewArray (const struct __go_type_descriptor *, intgo)
void *
unsafe_NewArray (const struct __go_type_descriptor *descriptor, intgo n)
{
- uint64 size;
- void *ret;
-
- size = n * descriptor->__size;
- if (size == 0)
- ret = &runtime_zerobase;
- else if ((descriptor->__code & GO_NO_POINTERS) != 0)
- ret = runtime_mallocgc (size, FlagNoPointers, 1, 1);
- else
- {
- ret = runtime_mallocgc (size, 0, 1, 1);
-
- if (UseSpanType)
- runtime_settype (ret, (uintptr) descriptor | TypeInfo_Array);
- }
-
- return ret;
+ return runtime_cnewarray (descriptor, n);
}