summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-13 00:06:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-13 00:06:54 +0000
commit0c71e2808ee6378588523a31a8110f37c47d052d (patch)
treef23f6b5d7333c1045fa860dbf8f63c68f6d739c5 /ext/openssl
parenta3fa871534efbacb977cf1bca2e62ec70053c1e1 (diff)
ossl_x509store.c: typed data
* ext/openssl/ossl_x509store.c (ossl_x509stctx_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_x509store.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index 54455bdb72..3093e28af1 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -31,10 +31,10 @@
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 *argv, VALUE self)
/*
* 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)
* 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)