2010-12-03 05:34:57 +01:00
|
|
|
/* go-unsafe-newarray.c -- unsafe.NewArray function for Go.
|
|
|
|
|
|
|
|
Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
Use of this source code is governed by a BSD-style
|
|
|
|
license that can be found in the LICENSE file. */
|
|
|
|
|
2011-11-30 01:21:52 +01:00
|
|
|
#include "runtime.h"
|
2012-11-21 08:03:38 +01:00
|
|
|
#include "arch.h"
|
|
|
|
#include "malloc.h"
|
2010-12-03 05:34:57 +01:00
|
|
|
#include "go-type.h"
|
|
|
|
|
2012-03-02 17:38:43 +01:00
|
|
|
/* Implement unsafe_NewArray, called from the reflect package. */
|
2010-12-03 05:34:57 +01:00
|
|
|
|
2012-11-21 08:03:38 +01:00
|
|
|
void *unsafe_NewArray (const struct __go_type_descriptor *, intgo)
|
2013-01-24 20:44:23 +01:00
|
|
|
__asm__ (GOSYM_PREFIX "reflect.unsafe_NewArray");
|
2010-12-03 05:34:57 +01:00
|
|
|
|
|
|
|
/* The dynamic type of the argument will be a pointer to a type
|
|
|
|
descriptor. */
|
|
|
|
|
|
|
|
void *
|
2012-11-21 08:03:38 +01:00
|
|
|
unsafe_NewArray (const struct __go_type_descriptor *descriptor, intgo n)
|
2010-12-03 05:34:57 +01:00
|
|
|
{
|
2013-07-16 08:54:42 +02:00
|
|
|
return runtime_cnewarray (descriptor, n);
|
2010-12-03 05:34:57 +01:00
|
|
|
}
|