summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_pkcs7.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 22:38:01 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 22:38:01 +0000
commitbf368e4f48c8d8bbeb56b68f1457e126cebcc9ca (patch)
tree243e01a4c62659d6a6ef8694e146254f041393ba /ext/openssl/ossl_pkcs7.c
parentba19bcdda4b93c268090a99a3c7a3f0225d4cba4 (diff)
ossl_pkcs7.c: typed data
* ext/openssl/ossl_pkcs7.c (ossl_pkcs7_recip_info_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48805 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_pkcs7.c')
-rw-r--r--ext/openssl/ossl_pkcs7.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index 9119d64..f4a5088 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -48,10 +48,10 @@
if (!(p7ri)) { \
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS7_RECIP_INFO_free, (p7ri)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_recip_info_type, (p7ri)); \
} while (0)
#define GetPKCS7ri(obj, p7ri) do { \
- Data_Get_Struct((obj), PKCS7_RECIP_INFO, (p7ri)); \
+ TypedData_Get_Struct((obj), PKCS7_RECIP_INFO, &ossl_pkcs7_recip_info_type, (p7ri)); \
if (!(p7ri)) { \
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
} \
@@ -104,6 +104,20 @@ static const rb_data_type_t ossl_pkcs7_signer_info_type = {
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
};
+static void
+ossl_pkcs7_recip_info_free(void *ptr)
+{
+ PKCS7_RECIP_INFO_free(ptr);
+}
+
+static const rb_data_type_t ossl_pkcs7_recip_info_type = {
+ "OpenSSL/PKCS7/RECIP_INFO",
+ {
+ 0, ossl_pkcs7_recip_info_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* Public
* (MADE PRIVATE UNTIL SOMEBODY WILL NEED THEM)