ruby-changes:36732
From: nobu <ko1@a...>
Date: Sat, 13 Dec 2014 08:46:51 +0900 (JST)
Subject: [ruby-changes:36732] nobu:r48813 (trunk): ossl_x509ext.c: typed data
nobu 2014-12-13 08:46:42 +0900 (Sat, 13 Dec 2014) New Revision: 48813 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=48813 Log: ossl_x509ext.c: typed data * ext/openssl/ossl_x509ext.c (ossl_x509extfactory_type): use typed data. Modified files: trunk/ext/openssl/ossl_x509ext.c Index: ext/openssl/ossl_x509ext.c =================================================================== --- ext/openssl/ossl_x509ext.c (revision 48812) +++ ext/openssl/ossl_x509ext.c (revision 48813) @@ -30,10 +30,10 @@ https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509ext.c#L30 if (!((ctx) = OPENSSL_malloc(sizeof(X509V3_CTX)))) \ ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \ X509V3_set_ctx((ctx), NULL, NULL, NULL, NULL, 0); \ - (obj) = Data_Wrap_Struct((klass), 0, ossl_x509extfactory_free, (ctx)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_x509extfactory_type, (ctx)); \ } while (0) #define GetX509ExtFactory(obj, ctx) do { \ - Data_Get_Struct((obj), X509V3_CTX, (ctx)); \ + TypedData_Get_Struct((obj), X509V3_CTX, &ossl_x509extfactory_type, (ctx)); \ if (!(ctx)) { \ ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \ } \ @@ -112,11 +112,19 @@ DupX509ExtPtr(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_x509ext.c#L112 * Ext factory */ static void -ossl_x509extfactory_free(X509V3_CTX *ctx) +ossl_x509extfactory_free(void *ctx) { OPENSSL_free(ctx); } +static const rb_data_type_t ossl_x509extfactory_type = { + "OpenSSL/X509/EXTENSION/Factory", + { + 0, ossl_x509extfactory_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; + static VALUE ossl_x509extfactory_alloc(VALUE klass) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/