aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hash.c b/hash.c
index 36b595bfdd..e0f827b80f 100644
--- a/hash.c
+++ b/hash.c
@@ -5826,10 +5826,9 @@ rb_env_clear(void)
keys = env_keys(TRUE);
for (i=0; i<RARRAY_LEN(keys); i++) {
- VALUE val = rb_f_getenv(Qnil, RARRAY_AREF(keys, i));
- if (!NIL_P(val)) {
- env_delete(RARRAY_AREF(keys, i));
- }
+ VALUE key = RARRAY_AREF(keys, i);
+ const char *nam = RSTRING_PTR(key);
+ ruby_setenv(nam, 0);
}
RB_GC_GUARD(keys);
return envtbl;