summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_x509ext.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:46:30 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:46:30 +0000
commit3d0cbeaddd5cd26cdff86ec4760d3979b7532b1a (patch)
tree5e14d1f5a30440ff7acc3a4234bead99ac43c7c0 /ext/openssl/ossl_x509ext.c
parenteb2cdab02f2dc49cbd7edfc0135884dcaa5c44fc (diff)
ossl_x509ext.c: typed data
* ext/openssl/ossl_x509ext.c (ossl_x509ext_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48812 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_x509ext.c')
-rw-r--r--ext/openssl/ossl_x509ext.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index 48625f859b..2aa430d1d9 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -14,10 +14,10 @@
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, X509_EXTENSION_free, (ext)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_x509ext_type, (ext)); \
} while (0)
#define GetX509Ext(obj, ext) do { \
- Data_Get_Struct((obj), X509_EXTENSION, (ext)); \
+ TypedData_Get_Struct((obj), X509_EXTENSION, &ossl_x509ext_type, (ext)); \
if (!(ext)) { \
ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \
} \
@@ -46,6 +46,20 @@ VALUE cX509Ext;
VALUE cX509ExtFactory;
VALUE eX509ExtError;
+static void
+ossl_x509ext_free(void *ptr)
+{
+ X509_EXTENSION_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509ext_type = {
+ "OpenSSL/X509/EXTENSION",
+ {
+ 0, ossl_x509ext_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* Public
*/