]> Cypherpunks repositories - gostls13.git/commit
cmd/cgo: replace C.malloc with our own wrapper
authorRuss Cox <rsc@golang.org>
Wed, 11 Sep 2013 15:30:08 +0000 (11:30 -0400)
committerRuss Cox <rsc@golang.org>
Wed, 11 Sep 2013 15:30:08 +0000 (11:30 -0400)
commit397ba2cb4a10ec5e383f1df7617b4b8bccf8dfab
treeb1330fa0f88480852ed16e238852fc0dcff4de10
parent89b26760d7dfe4ae8ee65e4b2c21fec8a15f449b
cmd/cgo: replace C.malloc with our own wrapper

This allows us to make two changes:

1. Force the argument type to be size_t, even on broken
   systems that declare malloc to take a ulong.

2. Call runtime.throw if malloc fails.
   (That is, the program crashes; it does not panic.)

Fixes #3403.
Fixes #5926.

R=golang-dev, iant
CC=golang-dev
https://golang.org/cl/13413047
src/cmd/cgo/ast.go
src/cmd/cgo/main.go
src/cmd/cgo/out.go
src/pkg/runtime/cgocall.c