mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* hash.c (env_has_value, env_index): must match exactly.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
275d6a5775
commit
f284f6a41b
2 changed files with 8 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
|||
Fri Nov 28 19:28:18 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* hash.c (env_has_value, env_index): must match exactly.
|
||||
|
||||
Fri Nov 28 17:59:20 2003 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_env.rb: add tests for ENV.
|
||||
|
|
6
hash.c
6
hash.c
|
@ -1598,7 +1598,8 @@ env_has_value(dmy, value)
|
|||
while (*env) {
|
||||
char *s = strchr(*env, '=');
|
||||
if (s++) {
|
||||
if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) {
|
||||
long len = strlen(s);
|
||||
if (RSTRING(value)->len == len && strncmp(s, RSTRING(value)->ptr, len) == 0) {
|
||||
FREE_ENVIRON(environ);
|
||||
return Qtrue;
|
||||
}
|
||||
|
@ -1621,7 +1622,8 @@ env_index(dmy, value)
|
|||
while (*env) {
|
||||
char *s = strchr(*env, '=');
|
||||
if (s++) {
|
||||
if (strncmp(s, RSTRING(value)->ptr, strlen(s)) == 0) {
|
||||
long len = strlen(s);
|
||||
if (RSTRING(value)->len == len && strncmp(s, RSTRING(value)->ptr, len) == 0) {
|
||||
str = env_str_new(*env, s-*env-1);
|
||||
FREE_ENVIRON(environ);
|
||||
return str;
|
||||
|
|
Loading…
Reference in a new issue