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

ruby-changes:36716

From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 06:58:46 +0900 (JST)
Subject: [ruby-changes:36716] nobu:r48796 (trunk): ossl_ocsp.c: typed data

nobu	2014-12-13 06:58:11 +0900 (Sat, 13 Dec 2014)

  New Revision: 48796

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

  Log:
    ossl_ocsp.c: typed data
    
    * ext/openssl/ossl_ocsp.c (ossl_ocsp_response_type): use typed
      data.

  Modified files:
    trunk/ext/openssl/ossl_ocsp.c
Index: ext/openssl/ossl_ocsp.c
===================================================================
--- ext/openssl/ossl_ocsp.c	(revision 48795)
+++ ext/openssl/ossl_ocsp.c	(revision 48796)
@@ -28,10 +28,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L28
 
 #define WrapOCSPRes(klass, obj, res) do { \
     if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
-    (obj) = Data_Wrap_Struct((klass), 0, OCSP_RESPONSE_free, (res)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_ocsp_response_type, (res)); \
 } while (0)
 #define GetOCSPRes(obj, res) do { \
-    Data_Get_Struct((obj), OCSP_RESPONSE, (res)); \
+    TypedData_Get_Struct((obj), OCSP_RESPONSE, &ossl_ocsp_response_type, (res)); \
     if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
 } while (0)
 #define SafeGetOCSPRes(obj, res) do { \
@@ -85,6 +85,20 @@ static const rb_data_type_t ossl_ocsp_re https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L85
     },
     0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
 };
+
+static void
+ossl_ocsp_response_free(void *ptr)
+{
+    OCSP_RESPONSE_free(ptr);
+}
+
+static const rb_data_type_t ossl_ocsp_response_type = {
+    "OpenSSL/OCSP/RESPONSE",
+    {
+	0, ossl_ocsp_response_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
 
 /*
  * Public

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

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