diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-12 21:58:22 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-12 21:58:22 +0000 |
commit | 457cd40f30593b982d8f8933ab4d62949b372616 (patch) | |
tree | 3af3f31c2e19dfc34f5ee378034c34a8c705caca | |
parent | e97e41e34a36efb400ff96841252c8fb81cee92a (diff) | |
download | ruby-457cd40f30593b982d8f8933ab4d62949b372616.tar.gz |
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
-rw-r--r-- | ext/openssl/ossl_ocsp.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c index fbe8ebf60b..dc31d79cf7 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -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 */ |