diff --git a/ChangeLog b/ChangeLog index 0661eaf503..c5cad66f41 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,30 +1,7 @@ -Thu May 30 19:47:42 2013 Yusuke Endoh +Fri May 31 11:58:24 2013 Nobuyoshi Nakada - * vm_insnhelper.c (vm_callee_setup_keyword_arg, - vm_callee_setup_arg_complex): consider a hash argument for keyword - only when the number of arguments is more than the expected - mandatory parameters. [ruby-core:53199] [ruby-trunk - Bug #8040] - - * test/ruby/test_keyword.rb: update a test for above. - -Thu May 30 17:55:04 2013 Zachary Scott - - * process.c: RDoc on Process.spawn - -Thu May 30 00:08:14 2013 Koichi Sasada - - * gc.c (gc_profile_enable): rest_sweep() to finish last GC. - Profiling record is allocated at first of marking phase. - Enable at lazy sweeping may cause an error (SEGV). - -Wed May 29 10:33:27 2013 Koichi Sasada - - * hash.c: fix WB bug. - (1) Hash's key also needs WB. - (2) callback parameter *key and *value of st_update() is not a - storage of st_table itself (only local variable). So that - OBJ_WRITE() is not suitable, especially for `!existing'. - OBJ_WRITTEN() is used instead of OBJ_WRITE(). + * vm_method.c (set_visibility): extract from rb_mod_public(), + rb_mod_protected() and rb_mod_private(). Tue May 28 12:31:21 2013 Koichi Sasada @@ -1448,7 +1425,7 @@ Sat May 4 04:13:27 2013 KOSAKI Motohiro Fri May 3 19:32:13 2013 Takeyuki FUJIOKA - * lib/cgi/util.rb: All class methods modulized. + * lib/cgi/util.rb: All class methods moduleized. We can use these methods like a function when "include CGI::Util". [Feature #8354] diff --git a/vm_method.c b/vm_method.c index fe0df18af5..be2224fa63 100644 --- a/vm_method.c +++ b/vm_method.c @@ -1290,6 +1290,19 @@ set_method_visibility(VALUE self, int argc, VALUE *argv, rb_method_flag_t ex) rb_clear_cache_by_class(self); } +static VALUE +set_visibility(int argc, VALUE *argv, VALUE module, int visi) +{ + secure_visibility(module); + if (argc == 0) { + SCOPE_SET(visi); + } + else { + set_method_visibility(module, argc, argv, visi); + } + return module; +} + /* * call-seq: * public -> self @@ -1305,14 +1318,7 @@ set_method_visibility(VALUE self, int argc, VALUE *argv, rb_method_flag_t ex) static VALUE rb_mod_public(int argc, VALUE *argv, VALUE module) { - secure_visibility(module); - if (argc == 0) { - SCOPE_SET(NOEX_PUBLIC); - } - else { - set_method_visibility(module, argc, argv, NOEX_PUBLIC); - } - return module; + return set_visibility(argc, argv, module, NOEX_PUBLIC); } /* @@ -1330,14 +1336,7 @@ rb_mod_public(int argc, VALUE *argv, VALUE module) static VALUE rb_mod_protected(int argc, VALUE *argv, VALUE module) { - secure_visibility(module); - if (argc == 0) { - SCOPE_SET(NOEX_PROTECTED); - } - else { - set_method_visibility(module, argc, argv, NOEX_PROTECTED); - } - return module; + return set_visibility(argc, argv, module, NOEX_PROTECTED); } /* @@ -1364,14 +1363,7 @@ rb_mod_protected(int argc, VALUE *argv, VALUE module) static VALUE rb_mod_private(int argc, VALUE *argv, VALUE module) { - secure_visibility(module); - if (argc == 0) { - SCOPE_SET(NOEX_PRIVATE); - } - else { - set_method_visibility(module, argc, argv, NOEX_PRIVATE); - } - return module; + return set_visibility(argc, argv, module, NOEX_PRIVATE); } /*