ruby-changes:36718
From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 06:58:49 +0900 (JST)
Subject: [ruby-changes:36718] nobu:r48798 (trunk): ossl_ocsp.c: typed data
nobu 2014-12-13 06:58:22 +0900 (Sat, 13 Dec 2014) New Revision: 48798 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48798 Log: ossl_ocsp.c: typed data * ext/openssl/ossl_ocsp.c (ossl_ocsp_certid_type): use typed data. Modified files: trunk/ext/openssl/ossl_ocsp.c Index: ext/openssl/ossl_ocsp.c =================================================================== --- ext/openssl/ossl_ocsp.c (revision 48797) +++ ext/openssl/ossl_ocsp.c (revision 48798) @@ -54,10 +54,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L54 #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 { \ @@ -113,6 +113,20 @@ static const rb_data_type_t ossl_ocsp_ba https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_ocsp.c#L113 }, 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/