summaryrefslogtreecommitdiff
path: root/src/runtime/env_posix.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-11-11 17:05:37 -0500
committerRuss Cox <rsc@golang.org>2014-11-11 17:05:37 -0500
commit9f99d531a05027ea12315a6421edf0aa9f905d70 (patch)
treee812f639f2771baf6e8ea89005d111379e38347b /src/runtime/env_posix.go
parentfee9e47559cac5ad31a36747627431742ac079d2 (diff)
downloadgo-git-9f99d531a05027ea12315a6421edf0aa9f905d70.tar.gz
[dev.cc] runtime/cgo: convert from C to Go
The conversion was done with an automated tool and then modified only as necessary to make it compile and run. [This CL is part of the removal of C code from package runtime. See golang.org/s/dev.cc for an overview.] LGTM=r R=r CC=austin, dvyukov, golang-codereviews, iant, khr https://golang.org/cl/168500043
Diffstat (limited to 'src/runtime/env_posix.go')
-rw-r--r--src/runtime/env_posix.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/runtime/env_posix.go b/src/runtime/env_posix.go
index dd57872d7c..03c7a5a4af 100644
--- a/src/runtime/env_posix.go
+++ b/src/runtime/env_posix.go
@@ -8,8 +8,6 @@ package runtime
import "unsafe"
-func environ() []string
-
func getenv(s *byte) *byte {
val := gogetenv(gostringnocopy(s))
if val == "" {
@@ -32,13 +30,13 @@ func gogetenv(key string) string {
return ""
}
-var _cgo_setenv uintptr // pointer to C function
-var _cgo_unsetenv uintptr // pointer to C function
+var _cgo_setenv unsafe.Pointer // pointer to C function
+var _cgo_unsetenv unsafe.Pointer // pointer to C function
// Update the C environment if cgo is loaded.
// Called from syscall.Setenv.
func syscall_setenv_c(k string, v string) {
- if _cgo_setenv == 0 {
+ if _cgo_setenv == nil {
return
}
arg := [2]unsafe.Pointer{cstring(k), cstring(v)}
@@ -48,7 +46,7 @@ func syscall_setenv_c(k string, v string) {
// Update the C environment if cgo is loaded.
// Called from syscall.unsetenv.
func syscall_unsetenv_c(k string) {
- if _cgo_unsetenv == 0 {
+ if _cgo_unsetenv == nil {
return
}
arg := [1]unsafe.Pointer{cstring(k)}