aboutsummaryrefslogtreecommitdiff
path: root/libgo/runtime/go-unsetenv.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2016-11-18 16:03:13 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2016-11-18 16:03:13 +0000
commitd6255159e86e432a5825f463150f27c1fc5a0268 (patch)
tree356d413f3cd82dbe584ad7d102361dc23a5e300a /libgo/runtime/go-unsetenv.c
parentd519aeda8b73ab7a9697b1817ed4655dfb5bbdb4 (diff)
downloadgcc-d6255159e86e432a5825f463150f27c1fc5a0268.zip
gcc-d6255159e86e432a5825f463150f27c1fc5a0268.tar.gz
gcc-d6255159e86e432a5825f463150f27c1fc5a0268.tar.bz2
runtime: don't call __go_alloc/__go_free in environment functions
Reviewed-on: https://go-review.googlesource.com/33363 From-SVN: r242594
Diffstat (limited to 'libgo/runtime/go-unsetenv.c')
-rw-r--r--libgo/runtime/go-unsetenv.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/libgo/runtime/go-unsetenv.c b/libgo/runtime/go-unsetenv.c
index 409436a..2135997 100644
--- a/libgo/runtime/go-unsetenv.c
+++ b/libgo/runtime/go-unsetenv.c
@@ -9,10 +9,7 @@
#include <stddef.h>
#include <stdlib.h>
-#include "go-alloc.h"
#include "runtime.h"
-#include "arch.h"
-#include "malloc.h"
/* Unset an environment variable from Go. This is called by
syscall.Unsetenv. */
@@ -24,7 +21,6 @@ unsetenv_c (String k)
{
const byte *ks;
unsigned char *kn;
- intgo len;
ks = k.str;
if (ks == NULL)
@@ -33,14 +29,11 @@ unsetenv_c (String k)
#ifdef HAVE_UNSETENV
- if (ks != NULL && ks[k.len] != 0)
+ if (ks[k.len] != 0)
{
- // Objects that are explicitly freed must be at least 16 bytes in size,
- // so that they are not allocated using tiny alloc.
- len = k.len + 1;
- if (len < TinySize)
- len = TinySize;
- kn = __go_alloc (len);
+ kn = malloc (k.len + 1);
+ if (kn == NULL)
+ runtime_throw ("out of malloc memory");
__builtin_memcpy (kn, ks, k.len);
ks = kn;
}
@@ -50,5 +43,5 @@ unsetenv_c (String k)
#endif /* !defined(HAVE_UNSETENV) */
if (kn != NULL)
- __go_free (kn);
+ free (kn);
}