summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_x509revoked.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:59:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:59:36 +0000
commit7db35b0399187f043aa5e5a34ff0815181b0c738 (patch)
treedf84e7ec9a5f7528f086012244b681b0ab26a83c /ext/openssl/ossl_x509revoked.c
parent0b671673dcf8df629c3054c64e2c8ce5d8df1bd8 (diff)
ossl_x509revoked.c: typed data
* ext/openssl/ossl_x509revoked.c (ossl_x509rev_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_x509revoked.c')
-rw-r--r--ext/openssl/ossl_x509revoked.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c
index c98a95e..30c362c 100644
--- a/ext/openssl/ossl_x509revoked.c
+++ b/ext/openssl/ossl_x509revoked.c
@@ -14,10 +14,10 @@
if (!(rev)) { \
ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, X509_REVOKED_free, (rev)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_x509rev_type, (rev)); \
} while (0)
#define GetX509Rev(obj, rev) do { \
- Data_Get_Struct((obj), X509_REVOKED, (rev)); \
+ TypedData_Get_Struct((obj), X509_REVOKED, &ossl_x509rev_type, (rev)); \
if (!(rev)) { \
ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \
} \
@@ -33,6 +33,20 @@
VALUE cX509Rev;
VALUE eX509RevError;
+static void
+ossl_x509rev_free(void *ptr)
+{
+ X509_REVOKED_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509rev_type = {
+ "OpenSSL/X509/REV",
+ {
+ 0, ossl_x509rev_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* PUBLIC
*/