ruby-changes:36731
From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 08:46:45 +0900 (JST)
Subject: [ruby-changes:36731] nobu:r48812 (trunk): ossl_x509ext.c: typed data
nobu 2014-12-13 08:46:30 +0900 (Sat, 13 Dec 2014) New Revision: 48812 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48812 Log: ossl_x509ext.c: typed data * ext/openssl/ossl_x509ext.c (ossl_x509ext_type): use typed data. Modified files: trunk/ext/openssl/ossl_x509ext.c Index: ext/openssl/ossl_x509ext.c =================================================================== --- ext/openssl/ossl_x509ext.c (revision 48811) +++ ext/openssl/ossl_x509ext.c (revision 48812) @@ -14,10 +14,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509ext.c#L14 if (!(ext)) { \ ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \ } \ - (obj) = Data_Wrap_Struct((klass), 0, X509_EXTENSION_free, (ext)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_x509ext_type, (ext)); \ } while (0) #define GetX509Ext(obj, ext) do { \ - Data_Get_Struct((obj), X509_EXTENSION, (ext)); \ + TypedData_Get_Struct((obj), X509_EXTENSION, &ossl_x509ext_type, (ext)); \ if (!(ext)) { \ ossl_raise(rb_eRuntimeError, "EXT wasn't initialized!"); \ } \ @@ -46,6 +46,20 @@ VALUE cX509Ext; https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509ext.c#L46 VALUE cX509ExtFactory; VALUE eX509ExtError; +static void +ossl_x509ext_free(void *ptr) +{ + X509_EXTENSION_free(ptr); +} + +static const rb_data_type_t ossl_x509ext_type = { + "OpenSSL/X509/EXTENSION", + { + 0, ossl_x509ext_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; + /* * Public */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/