ruby-changes:36717
From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 06:58:46 +0900 (JST)
Subject: [ruby-changes:36717] nobu:r48797 (trunk): ossl_ocsp.c: typed data
nobu 2014-12-13 06:58:17 +0900 (Sat, 13 Dec 2014) New Revision: 48797 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48797 Log: ossl_ocsp.c: typed data * ext/openssl/ossl_ocsp.c (ossl_ocsp_basicresp_type): use typed data. Modified files: trunk/ext/openssl/ossl_ocsp.c Index: ext/openssl/ossl_ocsp.c =================================================================== --- ext/openssl/ossl_ocsp.c (revision 48796) +++ ext/openssl/ossl_ocsp.c (revision 48797) @@ -41,10 +41,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L41 #define WrapOCSPBasicRes(klass, obj, res) do { \ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \ - (obj) = Data_Wrap_Struct((klass), 0, OCSP_BASICRESP_free, (res)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_ocsp_basicresp_type, (res)); \ } while (0) #define GetOCSPBasicRes(obj, res) do { \ - Data_Get_Struct((obj), OCSP_BASICRESP, (res)); \ + TypedData_Get_Struct((obj), OCSP_BASICRESP, &ossl_ocsp_basicresp_type, (res)); \ if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \ } while (0) #define SafeGetOCSPBasicRes(obj, res) do { \ @@ -99,6 +99,20 @@ static const rb_data_type_t ossl_ocsp_re https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L99 }, 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, }; + +static void +ossl_ocsp_basicresp_free(void *ptr) +{ + OCSP_BASICRESP_free(ptr); +} + +static const rb_data_type_t ossl_ocsp_basicresp_type = { + "OpenSSL/OCSP/BASICRESP", + { + 0, ossl_ocsp_basicresp_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; /* * Public -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/