diff options
| author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-11 00:42:30 +0000 |
|---|---|---|
| committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-01-11 00:42:30 +0000 |
| commit | 42d4569018520bd800c4438e798705de444e0f27 (patch) | |
| tree | 496390c660bc47071ce4d9c08d7dab892d17b235 | |
| parent | f1ef16986158cc8ec7f95e9f0e49a9ffa5e5ce77 (diff) | |
* hash.c (rb_hash_s_create): set nil as the value if assoc length
is not enough. [ruby-core:21249]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@21423 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | hash.c | 12 | ||||
| -rw-r--r-- | version.h | 6 |
3 files changed, 17 insertions, 6 deletions
@@ -1,3 +1,8 @@ +Sun Jan 11 09:42:28 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> + + * hash.c (rb_hash_s_create): set nil as the value if assoc length + is not enough. [ruby-core:21249] + Fri Jan 9 15:20:17 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> * eval.c (TAG_THREAD): to start a new thread. @@ -357,10 +357,16 @@ rb_hash_s_create(argc, argv, klass) hash = hash_alloc(klass); for (i = 0; i < RARRAY_LEN(tmp); ++i) { VALUE v = rb_check_array_type(RARRAY_PTR(tmp)[i]); - + VALUE key, val = Qnil; + if (NIL_P(v)) continue; - if (RARRAY_LEN(v) < 1 || 2 < RARRAY_LEN(v)) continue; - rb_hash_aset(hash, RARRAY_PTR(v)[0], RARRAY_PTR(v)[1]); + switch (RARRAY_LEN(v)) { + case 2: + val = RARRAY_PTR(v)[1]; + case 1: + key = RARRAY_PTR(v)[0]; + rb_hash_aset(hash, key, val); + } } return hash; } @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2009-01-09" +#define RUBY_RELEASE_DATE "2009-01-11" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20090109 +#define RUBY_RELEASE_CODE 20090111 #define RUBY_PATCHLEVEL 5000 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 1 -#define RUBY_RELEASE_DAY 9 +#define RUBY_RELEASE_DAY 11 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; |
