diff options
Diffstat (limited to 'libgo/runtime/go-unsetenv.c')
-rw-r--r-- | libgo/runtime/go-unsetenv.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libgo/runtime/go-unsetenv.c b/libgo/runtime/go-unsetenv.c index 409436a0d3..21359975f2 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); } |