diff options
| author | Russ Cox <rsc@golang.org> | 2015-04-15 15:00:42 -0400 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2015-04-17 01:30:47 +0000 |
| commit | 6a2b0c0b6d527d45860ec6c0d860b6aebfedea2e (patch) | |
| tree | b8156632f788ae13f5b7591a61092a59cdc7ea55 /src/runtime/cgo/callbacks.go | |
| parent | 89b7c66d0d14462fd7893be4290bdfe5f9063ae1 (diff) | |
| download | go-6a2b0c0b6d527d45860ec6c0d860b6aebfedea2e.tar.xz | |
runtime: delete cgo_allocate
This memory is untyped and can't be used anymore.
The next version of SWIG won't need it.
Change-Id: I592b287c5f5186975ee09a9b28d8efe3b57134e7
Reviewed-on: https://go-review.googlesource.com/8956
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/runtime/cgo/callbacks.go')
| -rw-r--r-- | src/runtime/cgo/callbacks.go | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/runtime/cgo/callbacks.go b/src/runtime/cgo/callbacks.go index cbaf064bd8..1682341596 100644 --- a/src/runtime/cgo/callbacks.go +++ b/src/runtime/cgo/callbacks.go @@ -22,32 +22,6 @@ func _runtime_cgocallback(unsafe.Pointer, unsafe.Pointer, uintptr) //go:cgo_export_static crosscall2 //go:cgo_export_dynamic crosscall2 -// Allocate memory. This allocates the requested number of bytes in -// memory controlled by the Go runtime. The allocated memory will be -// zeroed. You are responsible for ensuring that the Go garbage -// collector can see a pointer to the allocated memory for as long as -// it is valid, e.g., by storing a pointer in a local variable in your -// C function, or in memory allocated by the Go runtime. If the only -// pointers are in a C global variable or in memory allocated via -// malloc, then the Go garbage collector may collect the memory. - -// Call like this in code compiled with gcc: -// struct { size_t len; void *ret; } a; -// a.len = /* number of bytes to allocate */; -// crosscall2(_cgo_allocate, &a, sizeof a); -// /* Here a.ret is a pointer to the allocated memory. */ - -//go:linkname _runtime_cgo_allocate_internal runtime._cgo_allocate_internal -var _runtime_cgo_allocate_internal byte - -//go:linkname _cgo_allocate _cgo_allocate -//go:cgo_export_static _cgo_allocate -//go:cgo_export_dynamic _cgo_allocate -//go:nosplit -func _cgo_allocate(a unsafe.Pointer, n int32) { - _runtime_cgocallback(unsafe.Pointer(&_runtime_cgo_allocate_internal), a, uintptr(n)) -} - // Panic. The argument is converted into a Go string. // Call like this in code compiled with gcc: |
