1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-12-12 22:37:55 +00:00
parent 374fe20e4f
commit b8897cd60f

View file

@ -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)