summaryrefslogtreecommitdiff
path: root/src/runtime/cgo
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2014-10-01 11:17:15 -0700
committerBrad Fitzpatrick <bradfitz@golang.org>2014-10-01 11:17:15 -0700
commit52a0a3f43171c79c11a7c024c757e9b084d2bbed (patch)
tree911ebc3a34973aa9d2b0ccb42bb0b787147d273c /src/runtime/cgo
parent00f7bc64366c3b39ca947e489c8208ff4f0e3aa3 (diff)
downloadgo-52a0a3f43171c79c11a7c024c757e9b084d2bbed.tar.gz
os, syscall: add Unsetenv
Also address a TODO, making Clearenv pass through to cgo. Based largely on Minux's earlier https://codereview.appspot.com/82040044 Fixes Issue 6423 LGTM=iant, alex.brainman, r, rsc R=rsc, iant, r, alex.brainman CC=golang-codereviews https://codereview.appspot.com/148370043
Diffstat (limited to 'src/runtime/cgo')
-rw-r--r--src/runtime/cgo/gcc_setenv.c7
-rw-r--r--src/runtime/cgo/setenv.c3
2 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/cgo/gcc_setenv.c b/src/runtime/cgo/gcc_setenv.c
index 8b128b946..af0fc5d8d 100644
--- a/src/runtime/cgo/gcc_setenv.c
+++ b/src/runtime/cgo/gcc_setenv.c
@@ -14,3 +14,10 @@ x_cgo_setenv(char **arg)
{
setenv(arg[0], arg[1], 1);
}
+
+/* Stub for calling unsetenv */
+void
+x_cgo_unsetenv(char *arg)
+{
+ unsetenv(arg);
+}
diff --git a/src/runtime/cgo/setenv.c b/src/runtime/cgo/setenv.c
index ee529904f..76d88cbf1 100644
--- a/src/runtime/cgo/setenv.c
+++ b/src/runtime/cgo/setenv.c
@@ -5,6 +5,9 @@
// +build darwin dragonfly freebsd linux netbsd openbsd
#pragma cgo_import_static x_cgo_setenv
+#pragma cgo_import_static x_cgo_unsetenv
void x_cgo_setenv(char**);
void (*runtimeĀ·_cgo_setenv)(char**) = x_cgo_setenv;
+void x_cgo_unsetenv(char**);
+void (*runtimeĀ·_cgo_unsetenv)(char**) = x_cgo_unsetenv;