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

ruby-changes:36715

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

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

  New Revision: 48795

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

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

  Modified files:
    trunk/ext/openssl/ossl_ocsp.c
Index: ext/openssl/ossl_ocsp.c
===================================================================
--- ext/openssl/ossl_ocsp.c	(revision 48794)
+++ ext/openssl/ossl_ocsp.c	(revision 48795)
@@ -15,10 +15,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L15
 
 #define WrapOCSPReq(klass, obj, req) do { \
     if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
-    (obj) = Data_Wrap_Struct((klass), 0, OCSP_REQUEST_free, (req)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_ocsp_request_type, (req)); \
 } while (0)
 #define GetOCSPReq(obj, req) do { \
-    Data_Get_Struct((obj), OCSP_REQUEST, (req)); \
+    TypedData_Get_Struct((obj), OCSP_REQUEST, &ossl_ocsp_request_type, (req)); \
     if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
 } while (0)
 #define SafeGetOCSPReq(obj, req) do { \
@@ -72,6 +72,20 @@ VALUE cOCSPRes; https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L72
 VALUE cOCSPBasicRes;
 VALUE cOCSPCertId;
 
+static void
+ossl_ocsp_request_free(void *ptr)
+{
+    OCSP_REQUEST_free(ptr);
+}
+
+static const rb_data_type_t ossl_ocsp_request_type = {
+    "OpenSSL/OCSP/REQUEST",
+    {
+	0, ossl_ocsp_request_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 /*
  * Public
  */

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

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