ruby-changes:10991
From: shyouhei <ko1@a...>
Date: Tue, 24 Feb 2009 02:40:13 +0900 (JST)
Subject: [ruby-changes:10991] Ruby:r22580 (ruby_1_8_7): merge revision(s) 21423:
shyouhei 2009-02-24 02:40:05 +0900 (Tue, 24 Feb 2009) New Revision: 22580 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22580 Log: merge revision(s) 21423: * hash.c (rb_hash_s_create): set nil as the value if assoc length is not enough. [ruby-core:21249] Modified files: branches/ruby_1_8_7/ChangeLog branches/ruby_1_8_7/hash.c branches/ruby_1_8_7/version.h Index: ruby_1_8_7/hash.c =================================================================== --- ruby_1_8_7/hash.c (revision 22579) +++ ruby_1_8_7/hash.c (revision 22580) @@ -357,10 +357,16 @@ 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; } Index: ruby_1_8_7/ChangeLog =================================================================== --- ruby_1_8_7/ChangeLog (revision 22579) +++ ruby_1_8_7/ChangeLog (revision 22580) @@ -1,3 +1,8 @@ +Tue Feb 24 02:35:29 2009 Nobuyoshi Nakada <nobu@r...> + + * hash.c (rb_hash_s_create): set nil as the value if assoc length + is not enough. [ruby-core:21249] + Sun Feb 22 22:08:45 2009 Nobuyoshi Nakada <nobu@r...> * eval.c (stack_extend): streamlined rb_thread_restore_context() Index: ruby_1_8_7/version.h =================================================================== --- ruby_1_8_7/version.h (revision 22579) +++ ruby_1_8_7/version.h (revision 22580) @@ -1,15 +1,15 @@ #define RUBY_VERSION "1.8.7" -#define RUBY_RELEASE_DATE "2009-02-22" +#define RUBY_RELEASE_DATE "2009-02-24" #define RUBY_VERSION_CODE 187 -#define RUBY_RELEASE_CODE 20090222 -#define RUBY_PATCHLEVEL 139 +#define RUBY_RELEASE_CODE 20090224 +#define RUBY_PATCHLEVEL 140 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 8 #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_YEAR 2009 #define RUBY_RELEASE_MONTH 2 -#define RUBY_RELEASE_DAY 22 +#define RUBY_RELEASE_DAY 24 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[]; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/