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

ruby-changes:36722

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 07:38:03 +0900 (JST)
Subject: [ruby-changes:36722] nobu:r48803 (trunk): ossl_pkcs7.c: typed data

nobu	2014-12-13 07:37:55 +0900 (Sat, 13 Dec 2014)

  New Revision: 48803

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

  Log:
    ossl_pkcs7.c: typed data
    
    * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_type): use typed data.

  Modified files:
    trunk/ext/openssl/ossl_pkcs7.c
Index: ext/openssl/ossl_pkcs7.c
===================================================================
--- ext/openssl/ossl_pkcs7.c	(revision 48802)
+++ ext/openssl/ossl_pkcs7.c	(revision 48803)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs7.c#L14
     if (!(pkcs7)) { \
 	ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, PKCS7_free, (pkcs7)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_type, (pkcs7)); \
 } while (0)
 #define GetPKCS7(obj, pkcs7) do { \
-    Data_Get_Struct((obj), PKCS7, (pkcs7)); \
+    TypedData_Get_Struct((obj), PKCS7, &ossl_pkcs7_type, (pkcs7)); \
     if (!(pkcs7)) { \
 	ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
     } \
@@ -76,6 +76,20 @@ VALUE cPKCS7Signer; https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs7.c#L76
 VALUE cPKCS7Recipient;
 VALUE ePKCS7Error;
 
+static void
+ossl_pkcs7_free(void *ptr)
+{
+    PKCS7_free(ptr);
+}
+
+static const rb_data_type_t ossl_pkcs7_type = {
+    "OpenSSL/PKCS7",
+    {
+	0, ossl_pkcs7_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * Public
  * (MADE PRIVATE UNTIL SOMEBODY WILL NEED THEM)

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

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