go-unsafe-newarray.c 729 B

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