diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-23 06:52:39 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-06-23 06:52:39 +0000 |
commit | 67dcad92b7fb9f8b95c8e4925061527fc8a8db3d (patch) | |
tree | 5b3dd49b72fbb459deeab5e049f85f5718eafd8e /hash.c | |
parent | eb050525c069ae82473a63fa0788acd5ceb7e04c (diff) | |
download | ruby-67dcad92b7fb9f8b95c8e4925061527fc8a8db3d.tar.gz |
* string.c (rb_str_upto): generate sequence according to "succ"
order. formerly check was done by dictionary order.
[ruby-talk:74138]
* string.c (rb_string_value): fill constant empty string along
with setting ELTS_SHARED if str->ptr is NULL. [ruby-core:01179]
* string.c (rb_string_value_ptr): ditto.
* string.c (rb_check_string_type): ditto.
* string.c (str_gsub): move END(0) check before mbclen2().
* string.c (scan_once): reduce END(0) check.
* io.c (rb_io_initialize): accept fixnum mode.
* eval.c (error_print): replace strchr() by memchr(), einfo may
contain "\0".
* pack.c (pack_unpack): range check for "@" move; initialize check
for "m".
* error.c (syserr_initialize): avoid buffer overflow.
* file.c (rb_file_s_readlink): expand buffer until readlink
succeed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3982 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -997,6 +997,7 @@ static VALUE env_str_new2(ptr) const char *ptr; { + if (!ptr) return Qnil; return env_str_new(ptr, strlen(ptr)); } @@ -1606,7 +1607,7 @@ env_index(dmy, value) char **env; VALUE str; - if (TYPE(value) != T_STRING) return Qnil; + StringValue(value); env = GET_ENVIRON(environ); while (*env) { char *s = strchr(*env, '=')+1; @@ -1638,15 +1639,12 @@ env_indexes(argc, argv) rb_warn("ENV.%s is deprecated; use ENV.values_at", rb_id2name(rb_frame_last_func())); for (i=0;i<argc;i++) { - char *v = 0; - if (TYPE(argv[i]) == T_STRING) { - v = getenv(RSTRING(argv[i])->ptr); - } - if (v) { - RARRAY(indexes)->ptr[i] = env_str_new2(v); + VALUE tmp = rb_check_string_type(argv[i]); + if (NIL_P(tmp)) { + RARRAY(indexes)->ptr[i] = Qnil; } else { - RARRAY(indexes)->ptr[i] = Qnil; + RARRAY(indexes)->ptr[i] = env_str_new2(getenv(RSTRING(tmp)->ptr)); } RARRAY(indexes)->len = i+1; } |