ruby-changes:36723
From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 07:38:08 +0900 (JST)
Subject: [ruby-changes:36723] nobu:r48804 (trunk): ossl_pkcs7.c: typed data
nobu 2014-12-13 07:37:58 +0900 (Sat, 13 Dec 2014) New Revision: 48804 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48804 Log: ossl_pkcs7.c: typed data * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_signer_info_type): use typed data. Modified files: trunk/ext/openssl/ossl_pkcs7.c Index: ext/openssl/ossl_pkcs7.c =================================================================== --- ext/openssl/ossl_pkcs7.c (revision 48803) +++ ext/openssl/ossl_pkcs7.c (revision 48804) @@ -31,10 +31,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs7.c#L31 if (!(p7si)) { \ ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \ } \ - (obj) = Data_Wrap_Struct((klass), 0, PKCS7_SIGNER_INFO_free, (p7si)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_signer_info_type, (p7si)); \ } while (0) #define GetPKCS7si(obj, p7si) do { \ - Data_Get_Struct((obj), PKCS7_SIGNER_INFO, (p7si)); \ + TypedData_Get_Struct((obj), PKCS7_SIGNER_INFO, &ossl_pkcs7_signer_info_type, (p7si)); \ if (!(p7si)) { \ ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \ } \ @@ -89,6 +89,20 @@ static const rb_data_type_t ossl_pkcs7_t https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_pkcs7.c#L89 }, 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, }; + +static void +ossl_pkcs7_signer_info_free(void *ptr) +{ + PKCS7_SIGNER_INFO_free(ptr); +} + +static const rb_data_type_t ossl_pkcs7_signer_info_type = { + "OpenSSL/PKCS7/SIGNER_INFO", + { + 0, ossl_pkcs7_signer_info_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; /* * Public -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/