github.com/llvm-mirror/llgo@v0.0.0-20190322182713-bf6f0a60fce1/third_party/gofrontend/libgo/runtime/go-unsafe-newarray.c (about)

     1  /* go-unsafe-newarray.c -- unsafe.NewArray function for Go.
     2  
     3     Copyright 2009 The Go Authors. All rights reserved.
     4     Use of this source code is governed by a BSD-style
     5     license that can be found in the LICENSE file.  */
     6  
     7  #include "runtime.h"
     8  #include "arch.h"
     9  #include "malloc.h"
    10  #include "go-type.h"
    11  #include "interface.h"
    12  
    13  /* Implement unsafe_NewArray, called from the reflect package.  */
    14  
    15  void *unsafe_NewArray (const struct __go_type_descriptor *, intgo)
    16    __asm__ (GOSYM_PREFIX "reflect.unsafe_NewArray");
    17  
    18  /* The dynamic type of the argument will be a pointer to a type
    19     descriptor.  */
    20  
    21  void *
    22  unsafe_NewArray (const struct __go_type_descriptor *descriptor, intgo n)
    23  {
    24    return runtime_cnewarray (descriptor, n);
    25  }