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

ruby-changes:36735

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

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

  New Revision: 48816

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

  Log:
    ossl_x509revoked.c: typed data
    
    * ext/openssl/ossl_x509revoked.c (ossl_x509rev_type): use typed
      data.

  Modified files:
    trunk/ext/openssl/ossl_x509revoked.c
Index: ext/openssl/ossl_x509revoked.c
===================================================================
--- ext/openssl/ossl_x509revoked.c	(revision 48815)
+++ ext/openssl/ossl_x509revoked.c	(revision 48816)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509revoked.c#L14
     if (!(rev)) { \
 	ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, X509_REVOKED_free, (rev)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_x509rev_type, (rev)); \
 } while (0)
 #define GetX509Rev(obj, rev) do { \
-    Data_Get_Struct((obj), X509_REVOKED, (rev)); \
+    TypedData_Get_Struct((obj), X509_REVOKED, &ossl_x509rev_type, (rev)); \
     if (!(rev)) { \
 	ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
     } \
@@ -33,6 +33,20 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509revoked.c#L33
 VALUE cX509Rev;
 VALUE eX509RevError;
 
+static void
+ossl_x509rev_free(void *ptr)
+{
+    X509_REVOKED_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509rev_type = {
+    "OpenSSL/X509/REV",
+    {
+	0, ossl_x509rev_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * PUBLIC
  */

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

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