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

ruby-changes:36721

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 07:37:59 +0900 (JST)
Subject: [ruby-changes:36721] nobu:r48802 (trunk): ossl_pkcs12.c: typed data

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

  New Revision: 48802

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

  Log:
    ossl_pkcs12.c: typed data
    
    * ext/openssl/ossl_pkcs12.c (ossl_pkcs12_type): use typed data.

  Modified files:
    trunk/ext/openssl/ossl_pkcs12.c
Index: ext/openssl/ossl_pkcs12.c
===================================================================
--- ext/openssl/ossl_pkcs12.c	(revision 48801)
+++ ext/openssl/ossl_pkcs12.c	(revision 48802)
@@ -7,11 +7,11 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs12.c#L7
 
 #define WrapPKCS12(klass, obj, p12) do { \
     if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
-    (obj) = Data_Wrap_Struct((klass), 0, PKCS12_free, (p12)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs12_type, (p12)); \
 } while (0)
 
 #define GetPKCS12(obj, p12) do { \
-    Data_Get_Struct((obj), PKCS12, (p12)); \
+    TypedData_Get_Struct((obj), PKCS12, &ossl_pkcs12_type, (p12)); \
     if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
 } while (0)
 
@@ -36,6 +36,20 @@ VALUE ePKCS12Error; https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs12.c#L36
 /*
  * Private
  */
+static void
+ossl_pkcs12_free(void *ptr)
+{
+    PKCS12_free(ptr);
+}
+
+static const rb_data_type_t ossl_pkcs12_type = {
+    "OpenSSL/PKCS12",
+    {
+	0, ossl_pkcs12_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 static VALUE
 ossl_pkcs12_s_allocate(VALUE klass)
 {

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

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