ruby-changes:36730
From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 08:39:16 +0900 (JST)
Subject: [ruby-changes:36730] nobu:r48811 (trunk): ossl_x509crl.c: typed data
nobu 2014-12-13 08:39:04 +0900 (Sat, 13 Dec 2014) New Revision: 48811 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48811 Log: ossl_x509crl.c: typed data * ext/openssl/ossl_x509crl.c (ossl_x509crl_type): use typed data. Modified files: trunk/ext/openssl/ossl_x509crl.c Index: ext/openssl/ossl_x509crl.c =================================================================== --- ext/openssl/ossl_x509crl.c (revision 48810) +++ ext/openssl/ossl_x509crl.c (revision 48811) @@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509crl.c#L14 if (!(crl)) { \ ossl_raise(rb_eRuntimeError, "CRL wasn't initialized!"); \ } \ - (obj) = Data_Wrap_Struct((klass), 0, X509_CRL_free, (crl)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_x509crl_type, (crl)); \ } while (0) #define GetX509CRL(obj, crl) do { \ - Data_Get_Struct((obj), X509_CRL, (crl)); \ + TypedData_Get_Struct((obj), X509_CRL, &ossl_x509crl_type, (crl)); \ if (!(crl)) { \ ossl_raise(rb_eRuntimeError, "CRL wasn't initialized!"); \ } \ @@ -33,6 +33,20 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509crl.c#L33 VALUE cX509CRL; VALUE eX509CRLError; +static void +ossl_x509crl_free(void *ptr) +{ + X509_CRL_free(ptr); +} + +static const rb_data_type_t ossl_x509crl_type = { + "OpenSSL/X509/CRL", + { + 0, ossl_x509crl_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; + /* * PUBLIC */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/