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

ruby-changes:36734

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 09:00:15 +0900 (JST)
Subject: [ruby-changes:36734] nobu:r48815 (trunk): ossl_x509req.c: typed data

nobu	2014-12-13 08:59:28 +0900 (Sat, 13 Dec 2014)

  New Revision: 48815

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

  Log:
    ossl_x509req.c: typed data
    
    * ext/openssl/ossl_x509req.c (ossl_x509req_type): use typed data.

  Modified files:
    trunk/ext/openssl/ossl_x509req.c
Index: ext/openssl/ossl_x509req.c
===================================================================
--- ext/openssl/ossl_x509req.c	(revision 48814)
+++ ext/openssl/ossl_x509req.c	(revision 48815)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509req.c#L14
     if (!(req)) { \
 	ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, X509_REQ_free, (req)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_x509req_type, (req)); \
 } while (0)
 #define GetX509Req(obj, req) do { \
-    Data_Get_Struct((obj), X509_REQ, (req)); \
+    TypedData_Get_Struct((obj), X509_REQ, &ossl_x509req_type, (req)); \
     if (!(req)) { \
 	ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \
     } \
@@ -33,6 +33,20 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509req.c#L33
 VALUE cX509Req;
 VALUE eX509ReqError;
 
+static void
+ossl_x509req_free(void *ptr)
+{
+    X509_REQ_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509req_type = {
+    "OpenSSL/X509/REQ",
+    {
+	0, ossl_x509req_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * Public functions
  */

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

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