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

ossl_ocsp.c: typed data

* ext/openssl/ossl_ocsp.c (ossl_ocsp_certid_type): use typed data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48798 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-12 21:58:22 +00:00
parent e97e41e34a
commit 457cd40f30

View file

@ -54,10 +54,10 @@
#define WrapOCSPCertId(klass, obj, cid) do { \
if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
(obj) = Data_Wrap_Struct((klass), 0, OCSP_CERTID_free, (cid)); \
(obj) = TypedData_Wrap_Struct((klass), &ossl_ocsp_certid_type, (cid)); \
} while (0)
#define GetOCSPCertId(obj, cid) do { \
Data_Get_Struct((obj), OCSP_CERTID, (cid)); \
TypedData_Get_Struct((obj), OCSP_CERTID, &ossl_ocsp_certid_type, (cid)); \
if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
} while (0)
#define SafeGetOCSPCertId(obj, cid) do { \
@ -114,6 +114,20 @@ static const rb_data_type_t ossl_ocsp_basicresp_type = {
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
};
static void
ossl_ocsp_certid_free(void *ptr)
{
OCSP_CERTID_free(ptr);
}
static const rb_data_type_t ossl_ocsp_certid_type = {
"OpenSSL/OCSP/CERTID",
{
0, ossl_ocsp_certid_free,
},
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
};
/*
* Public
*/