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

ruby-changes:36736

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 09:06:57 +0900 (JST)
Subject: [ruby-changes:36736] nobu:r48817 (trunk): ossl_x509store.c: typed data

nobu	2014-12-13 09:06:48 +0900 (Sat, 13 Dec 2014)

  New Revision: 48817

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

  Log:
    ossl_x509store.c: typed data
    
    * ext/openssl/ossl_x509store.c (ossl_x509store_type): use typed
      data.

  Modified files:
    trunk/ext/openssl/ossl_x509store.c
Index: ext/openssl/ossl_x509store.c
===================================================================
--- ext/openssl/ossl_x509store.c	(revision 48816)
+++ ext/openssl/ossl_x509store.c	(revision 48817)
@@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509store.c#L14
     if (!(st)) { \
 	ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, X509_STORE_free, (st)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_x509store_type, (st)); \
 } while (0)
 #define GetX509Store(obj, st) do { \
-    Data_Get_Struct((obj), X509_STORE, (st)); \
+    TypedData_Get_Struct((obj), X509_STORE, &ossl_x509store_type, (st)); \
     if (!(st)) { \
 	ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
     } \
@@ -51,6 +51,20 @@ VALUE cX509Store; https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509store.c#L51
 VALUE cX509StoreContext;
 VALUE eX509StoreError;
 
+static void
+ossl_x509store_free(void *ptr)
+{
+    X509_STORE_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509store_type = {
+    "OpenSSL/X509/STORE",
+    {
+	0, ossl_x509store_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * Public functions
  */

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

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