diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-12 21:58:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-12 21:58:11 +0000 |
commit | c3202f63b187327eb2c0c14e16fcbc8dd973c12f (patch) | |
tree | 631028b61836f25630e415028944419fcd51b492 /ext/openssl/ossl_ocsp.c | |
parent | 4bb6cb76f2cb869ce05ab5af5b591e899bf8125f (diff) | |
download | ruby-c3202f63b187327eb2c0c14e16fcbc8dd973c12f.tar.gz |
ossl_ocsp.c: typed data
* ext/openssl/ossl_ocsp.c (ossl_ocsp_response_type): use typed
data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_ocsp.c')
-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 f7491aeea3..715718e939 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -28,10 +28,10 @@ #define WrapOCSPRes(klass, obj, res) do { \ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \ - (obj) = Data_Wrap_Struct((klass), 0, OCSP_RESPONSE_free, (res)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_ocsp_response_type, (res)); \ } while (0) #define GetOCSPRes(obj, res) do { \ - Data_Get_Struct((obj), OCSP_RESPONSE, (res)); \ + TypedData_Get_Struct((obj), OCSP_RESPONSE, &ossl_ocsp_response_type, (res)); \ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \ } while (0) #define SafeGetOCSPRes(obj, res) do { \ @@ -86,6 +86,20 @@ static const rb_data_type_t ossl_ocsp_request_type = { 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, }; +static void +ossl_ocsp_response_free(void *ptr) +{ + OCSP_RESPONSE_free(ptr); +} + +static const rb_data_type_t ossl_ocsp_response_type = { + "OpenSSL/OCSP/RESPONSE", + { + 0, ossl_ocsp_response_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; + /* * Public */ |