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

ruby-changes:35698

From: zzak <ko1@a...>
Date: Sat, 4 Oct 2014 08:25:05 +0900 (JST)
Subject: [ruby-changes:35698] zzak:r47780 (trunk): * ext/openssl/ossl_rand.c: Use rb_define_module_function instead of

zzak	2014-10-04 08:24:50 +0900 (Sat, 04 Oct 2014)

  New Revision: 47780

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

  Log:
    * ext/openssl/ossl_rand.c: Use rb_define_module_function instead of
      macro. [Fixes GH-686] https://github.com/ruby/ruby/pull/686

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/ossl_rand.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 47779)
+++ ChangeLog	(revision 47780)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Oct  4 08:23:48 2014  Zachary Scott  <e@z...>
+
+	* ext/openssl/ossl_rand.c: Use rb_define_module_function instead of
+	  macro. [Fixes GH-686] https://github.com/ruby/ruby/pull/686
+
 Sat Oct  4 06:04:56 2014  Masaki Suketa <masaki.suketa@n...>
 
 	* ext/win32ole/win32ole_method.c(olemethod_set_member): remove
Index: ext/openssl/ossl_rand.c
===================================================================
--- ext/openssl/ossl_rand.c	(revision 47779)
+++ ext/openssl/ossl_rand.c	(revision 47780)
@@ -171,10 +171,6 @@ ossl_rand_status(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_rand.c#L171
     return RAND_status() ? Qtrue : Qfalse;
 }
 
-#define DEFMETH(class, name, func, argc) \
-	rb_define_method((class), (name), (func), (argc)); \
-	rb_define_singleton_method((class), (name), (func), (argc));
-
 /*
  * INIT
  */
@@ -189,14 +185,14 @@ Init_ossl_rand(void) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_rand.c#L185
 
     eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
 
-    DEFMETH(mRandom, "seed", ossl_rand_seed, 1);
-    DEFMETH(mRandom, "random_add", ossl_rand_add, 2);
-    DEFMETH(mRandom, "load_random_file", ossl_rand_load_file, 1);
-    DEFMETH(mRandom, "write_random_file", ossl_rand_write_file, 1);
-    DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
-    DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
-    DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
-    DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
-    DEFMETH(mRandom, "status?", ossl_rand_status, 0)
+    rb_define_module_function(mRandom, "seed", ossl_rand_seed, 1);
+    rb_define_module_function(mRandom, "random_add", ossl_rand_add, 2);
+    rb_define_module_function(mRandom, "load_random_file", ossl_rand_load_file, 1);
+    rb_define_module_function(mRandom, "write_random_file", ossl_rand_write_file, 1);
+    rb_define_module_function(mRandom, "random_bytes", ossl_rand_bytes, 1);
+    rb_define_module_function(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
+    rb_define_module_function(mRandom, "egd", ossl_rand_egd, 1);
+    rb_define_module_function(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+    rb_define_module_function(mRandom, "status?", ossl_rand_status, 0);
 }
 

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

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