summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:38:44 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 23:38:44 +0000
commitc3fdb1c3bd7ccf213a9bff384c85b11487093a9e (patch)
treedcf49feccd1d7e42a19ffc6619e79ea58ad944af /ext/openssl
parent2e78e44f5924cf7596c924a7433c8ee5e69927e1 (diff)
ossl_x509attr.c: typed data
* ext/openssl/ossl_x509attr.c (ossl_x509attr_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_x509attr.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index fdf0481c069..c9036cad901 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -14,10 +14,10 @@
if (!(attr)) { \
ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, X509_ATTRIBUTE_free, (attr)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_x509attr_type, (attr)); \
} while (0)
#define GetX509Attr(obj, attr) do { \
- Data_Get_Struct((obj), X509_ATTRIBUTE, (attr)); \
+ TypedData_Get_Struct((obj), X509_ATTRIBUTE, &ossl_x509attr_type, (attr)); \
if (!(attr)) { \
ossl_raise(rb_eRuntimeError, "ATTR wasn't initialized!"); \
} \
@@ -33,6 +33,20 @@
VALUE cX509Attr;
VALUE eX509AttrError;
+static void
+ossl_x509attr_free(void *ptr)
+{
+ X509_ATTRIBUTE_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509attr_type = {
+ "OpenSSL/X509/ATTRIBUTE",
+ {
+ 0, ossl_x509attr_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* Public
*/