summaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-12 05:31:47 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2001-06-12 05:31:47 +0000
commit991bbb0ea5110180a2d7f10a45de331608cd0291 (patch)
tree660edb1108304ba2d6fcd948cbe93f8cb2ff51e8 /hash.c
parentf25c73f315f2d1c4f8cea45ed74a0505f137338f (diff)
downloadruby-991bbb0ea5110180a2d7f10a45de331608cd0291.tar.gz
ruby-991bbb0ea5110180a2d7f10a45de331608cd0291.tar.xz
ruby-991bbb0ea5110180a2d7f10a45de331608cd0291.zip
* eval.c (method_eq): new method Method#==. [new]
* gc.c (STR_NO_ORIG): STR_NO_ORIG value was different between string.c and gc.c * eval.c (rb_eval): should convert *non-array at the end of arguments by using Array(). * hash.c (ruby_setenv): readline library leaves their environment strings uncopied. "free" check revised. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index f3c621ace..39a9a522d 100644
--- a/hash.c
+++ b/hash.c
@@ -1066,8 +1066,12 @@ ruby_setenv(name, value)
environ = tmpenv; /* tell exec where it is now */
}
if (!value) {
- if (environ[i] != origenviron[i])
- free(environ[i]);
+ if (environ != origenviron) {
+ char **envp = origenviron;
+ while (*envp && *envp != environ[i]) envp++;
+ if (!*envp)
+ free(environ[i]);
+ }
while (environ[i]) {
environ[i] = environ[i+1];
i++;