summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-31 02:58:45 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-05-31 02:58:45 +0000
commit6f017366adc1ad465057f9945c24d15c2c3a2106 (patch)
treefbad80368b16a3afdb7539f753d15babf7bf2233
parent6f9f8d2ef7d9c19e39194e6914e4cf39eaa5d473 (diff)
vm_method.c: extract set_visibility
* vm_method.c (set_visibility): extract from rb_mod_public(), rb_mod_protected() and rb_mod_private(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40993 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog31
-rw-r--r--vm_method.c40
2 files changed, 20 insertions, 51 deletions
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 <mame@tsg.ne.jp>
+Fri May 31 11:58:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
- * 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 <zachary@zacharyscott.net>
-
- * process.c: RDoc on Process.spawn
-
-Thu May 30 00:08:14 2013 Koichi Sasada <ko1@atdot.net>
-
- * 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 <ko1@atdot.net>
-
- * 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 <ko1@atdot.net>
@@ -1448,7 +1425,7 @@ Sat May 4 04:13:27 2013 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
Fri May 3 19:32:13 2013 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
- * 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);
}
/*