1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

ossl_x509ext.c: typed data

* ext/openssl/ossl_x509ext.c (ossl_x509extfactory_type): use typed
  data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-12 23:46:42 +00:00
parent 3d0cbeaddd
commit cfde2808ae

View file

@ -30,10 +30,10 @@
if (!((ctx) = OPENSSL_malloc(sizeof(X509V3_CTX)))) \ if (!((ctx) = OPENSSL_malloc(sizeof(X509V3_CTX)))) \
ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \ ossl_raise(rb_eRuntimeError, "CTX wasn't allocated!"); \
X509V3_set_ctx((ctx), NULL, NULL, NULL, NULL, 0); \ 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) } while (0)
#define GetX509ExtFactory(obj, ctx) do { \ #define GetX509ExtFactory(obj, ctx) do { \
Data_Get_Struct((obj), X509V3_CTX, (ctx)); \ TypedData_Get_Struct((obj), X509V3_CTX, &ossl_x509extfactory_type, (ctx)); \
if (!(ctx)) { \ if (!(ctx)) { \
ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \ ossl_raise(rb_eRuntimeError, "CTX wasn't initialized!"); \
} \ } \
@ -112,11 +112,19 @@ DupX509ExtPtr(VALUE obj)
* Ext factory * Ext factory
*/ */
static void static void
ossl_x509extfactory_free(X509V3_CTX *ctx) ossl_x509extfactory_free(void *ctx)
{ {
OPENSSL_free(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 static VALUE
ossl_x509extfactory_alloc(VALUE klass) ossl_x509extfactory_alloc(VALUE klass)
{ {