diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:11:55 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-09-13 13:11:55 +0200 |
commit | 80f18fc933cf3f3e829c5455a1023d69f7b86e52 (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /src/pkg/runtime/cgo/util.c | |
parent | 28592ee1ea1f5cdffcf85472f9de0285d928cf12 (diff) | |
download | golang-80f18fc933cf3f3e829c5455a1023d69f7b86e52.tar.gz |
Imported Upstream version 60
Diffstat (limited to 'src/pkg/runtime/cgo/util.c')
-rw-r--r-- | src/pkg/runtime/cgo/util.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/pkg/runtime/cgo/util.c b/src/pkg/runtime/cgo/util.c deleted file mode 100644 index 9d96521f5..000000000 --- a/src/pkg/runtime/cgo/util.c +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "libcgo.h" - -/* Stub for calling malloc from Go */ -static void -x_cgo_malloc(void *p) -{ - struct a { - long long n; - void *ret; - } *a = p; - - a->ret = malloc(a->n); -} - -void (*_cgo_malloc)(void*) = x_cgo_malloc; - -/* Stub for calling from Go */ -static void -x_cgo_free(void *p) -{ - struct a { - void *arg; - } *a = p; - - free(a->arg); -} - -void (*_cgo_free)(void*) = x_cgo_free; - -/* Stub for creating a new thread */ -static void -xlibcgo_thread_start(ThreadStart *arg) -{ - ThreadStart *ts; - - /* Make our own copy that can persist after we return. */ - ts = malloc(sizeof *ts); - if(ts == nil) { - fprintf(stderr, "runtime/cgo: out of memory in thread_start\n"); - abort(); - } - *ts = *arg; - - libcgo_sys_thread_start(ts); /* OS-dependent half */ -} - -void (*libcgo_thread_start)(ThreadStart*) = xlibcgo_thread_start; |