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

ruby-changes:36737

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

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

  New Revision: 48818

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

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

  Modified files:
    trunk/ext/openssl/ossl_x509store.c
Index: ext/openssl/ossl_x509store.c
===================================================================
--- ext/openssl/ossl_x509store.c	(revision 48817)
+++ ext/openssl/ossl_x509store.c	(revision 48818)
@@ -31,10 +31,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509store.c#L31
     if (!(ctx)) { \
 	ossl_raise(rb_eRuntimeError, "STORE_CTX wasn't initialized!"); \
     } \
-    (obj) = Data_Wrap_Struct((klass), 0, ossl_x509stctx_free, (ctx)); \
+    (obj) = TypedData_Wrap_Struct((klass), &ossl_x509stctx_type, (ctx)); \
 } while (0)
 #define GetX509StCtx(obj, ctx) do { \
-    Data_Get_Struct((obj), X509_STORE_CTX, (ctx)); \
+    TypedData_Get_Struct((obj), X509_STORE_CTX, &ossl_x509stctx_type, (ctx)); \
     if (!(ctx)) { \
 	ossl_raise(rb_eRuntimeError, "STORE_CTX is out of scope!"); \
     } \
@@ -356,7 +356,17 @@ ossl_x509store_verify(int argc, VALUE *a https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509store.c#L356
 /*
  * Public Functions
  */
-static void ossl_x509stctx_free(X509_STORE_CTX*);
+static void ossl_x509stctx_free(void*);
+
+
+static const rb_data_type_t ossl_x509stctx_type = {
+    "OpenSSL/X509/STORE_CTX",
+    {
+	0, ossl_x509stctx_free,
+    },
+    0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
 
 VALUE
 ossl_x509stctx_new(X509_STORE_CTX *ctx)
@@ -381,8 +391,9 @@ ossl_x509stctx_clear_ptr(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509store.c#L391
  * Private functions
  */
 static void
-ossl_x509stctx_free(X509_STORE_CTX *ctx)
+ossl_x509stctx_free(void *ptr)
 {
+    X509_STORE_CTX *ctx = ptr;
     if(ctx->untrusted)
 	sk_X509_pop_free(ctx->untrusted, X509_free);
     if(ctx->cert)

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

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