[前][次][番号順一覧][スレッド一覧]

ruby-changes:28941

From: nobu <ko1@a...>
Date: Fri, 31 May 2013 11:59:12 +0900 (JST)
Subject: [ruby-changes:28941] nobu:r40993 (trunk): vm_method.c: extract set_visibility

nobu	2013-05-31 11:58:45 +0900 (Fri, 31 May 2013)

  New Revision: 40993

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=40993

  Log:
    vm_method.c: extract set_visibility
    
    * vm_method.c (set_visibility): extract from rb_mod_public(),
      rb_mod_protected() and rb_mod_private().

  Modified files:
    trunk/ChangeLog
    trunk/vm_method.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 40992)
+++ ChangeLog	(revision 40993)
@@ -1,30 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Thu May 30 19:47:42 2013  Yusuke Endoh  <mame@t...>
+Fri May 31 11:58:24 2013  Nobuyoshi Nakada  <nobu@r...>
 
-	* 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@z...>
-
-	* process.c: RDoc on Process.spawn
-
-Thu May 30 00:08:14 2013  Koichi Sasada  <ko1@a...>
-
-	* 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@a...>
-
-	* 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@a...>
 
@@ -1448,7 +1425,7 @@ Sat May  4 04:13:27 2013  KOSAKI Motohir https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1425
 
 Fri May  3 19:32:13 2013  Takeyuki FUJIOKA  <xibbar@r...>
 
-	* 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]
 
Index: vm_method.c
===================================================================
--- vm_method.c	(revision 40992)
+++ vm_method.c	(revision 40993)
@@ -1290,6 +1290,19 @@ set_method_visibility(VALUE self, int ar https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1290
     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 ar https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1318
 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, VAL https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1336
 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, https://github.com/ruby/ruby/blob/trunk/vm_method.c#L1363
 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);
 }
 
 /*

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]