This source file includes following definitions.
- x_cgo_malloc
- x_cgo_free
- x_cgo_thread_start
#include "libcgo.h"
void
x_cgo_malloc(void *p)
{
struct a {
long long n;
void *ret;
} *a = p;
a->ret = malloc(a->n);
if(a->ret == NULL && a->n == 0)
a->ret = malloc(1);
}
void
x_cgo_free(void *p)
{
struct a {
void *arg;
} *a = p;
free(a->arg);
}
void
x_cgo_thread_start(ThreadStart *arg)
{
ThreadStart *ts;
ts = malloc(sizeof *ts);
if(ts == nil) {
fprintf(stderr, "runtime/cgo: out of memory in thread_start\n");
abort();
}
*ts = *arg;
_cgo_sys_thread_start(ts);
}