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

ruby-changes:36724

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

nobu	2014-12-13 07:38:01 +0900 (Sat, 13 Dec 2014)

  New Revision: 48805

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

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

  Modified files:
    trunk/ext/openssl/ossl_pkcs7.c
Index: ext/openssl/ossl_pkcs7.c
===================================================================
--- ext/openssl/ossl_pkcs7.c	(revision 48804)
+++ ext/openssl/ossl_pkcs7.c	(revision 48805)
@@ -48,10 +48,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs7.c#L48
     if (!(p7ri)) { \
 	ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, PKCS7_RECIP_INFO_free, (p7ri)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_recip_info_type, (p7ri)); \
 } while (0)
 #define GetPKCS7ri(obj, p7ri) do { \
-    Data_Get_Struct((obj), PKCS7_RECIP_INFO, (p7ri)); \
+    TypedData_Get_Struct((obj), PKCS7_RECIP_INFO, &ossl_pkcs7_recip_info_type, (p7ri)); \
     if (!(p7ri)) { \
 	ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
     } \
@@ -103,6 +103,20 @@ static const rb_data_type_t ossl_pkcs7_s https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs7.c#L103
     },
     0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
 };
+
+static void
+ossl_pkcs7_recip_info_free(void *ptr)
+{
+    PKCS7_RECIP_INFO_free(ptr);
+}
+
+static const rb_data_type_t ossl_pkcs7_recip_info_type = {
+    "OpenSSL/PKCS7/RECIP_INFO",
+    {
+	0, ossl_pkcs7_recip_info_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
 
 /*
  * Public

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

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