summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:39:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:39:04 +0000
commiteb2cdab02f2dc49cbd7edfc0135884dcaa5c44fc (patch)
treefab14be5ff5b3d2b2a5e7a27d9985eca7390cac0
parent3bc78d5bd8c70daf7cfbfba0d9583497e0c9651c (diff)
ossl_x509crl.c: typed data
* ext/openssl/ossl_x509crl.c (ossl_x509crl_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/openssl/ossl_x509crl.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index beacc26092..461c226f4c 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -14,10 +14,10 @@
if (!(crl)) { \
ossl_raise(rb_eRuntimeError, "CRL wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, X509_CRL_free, (crl)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_x509crl_type, (crl)); \
} while (0)
#define GetX509CRL(obj, crl) do { \
- Data_Get_Struct((obj), X509_CRL, (crl)); \
+ TypedData_Get_Struct((obj), X509_CRL, &ossl_x509crl_type, (crl)); \
if (!(crl)) { \
ossl_raise(rb_eRuntimeError, "CRL wasn't initialized!"); \
} \
@@ -33,6 +33,20 @@
VALUE cX509CRL;
VALUE eX509CRLError;
+static void
+ossl_x509crl_free(void *ptr)
+{
+ X509_CRL_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509crl_type = {
+ "OpenSSL/X509/CRL",
+ {
+ 0, ossl_x509crl_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* PUBLIC
*/