summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 22:37:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 22:37:55 +0000
commitb8897cd60fa27ed391672bf2298603e67c2f6186 (patch)
treec4a8f5c1603863eaea94da720995f7f1322202ef /ext/openssl
parent374fe20e4f463ff4e3b1b17eaddcb9512d568e2b (diff)
ossl_pkcs7.c: typed data
* ext/openssl/ossl_pkcs7.c (ossl_pkcs7_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-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 f476807..060d30b 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -14,10 +14,10 @@
if (!(pkcs7)) { \
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS7_free, (pkcs7)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_type, (pkcs7)); \
} while (0)
#define GetPKCS7(obj, pkcs7) do { \
- Data_Get_Struct((obj), PKCS7, (pkcs7)); \
+ TypedData_Get_Struct((obj), PKCS7, &ossl_pkcs7_type, (pkcs7)); \
if (!(pkcs7)) { \
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
} \
@@ -76,6 +76,20 @@ VALUE cPKCS7Signer;
VALUE cPKCS7Recipient;
VALUE ePKCS7Error;
+static void
+ossl_pkcs7_free(void *ptr)
+{
+ PKCS7_free(ptr);
+}
+
+static const rb_data_type_t ossl_pkcs7_type = {
+ "OpenSSL/PKCS7",
+ {
+ 0, ossl_pkcs7_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* Public
* (MADE PRIVATE UNTIL SOMEBODY WILL NEED THEM)