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

ossl_ssl.c: typed data

* ext/openssl/ossl_ssl.c (ossl_ssl_type): use typed data.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-12 21:58:34 +00:00
parent 060e693738
commit cd96afe993
2 changed files with 12 additions and 3 deletions

View file

@ -1133,15 +1133,23 @@ ossl_ssl_shutdown(SSL *ssl)
}
static void
ossl_ssl_free(SSL *ssl)
ossl_ssl_free(void *ssl)
{
SSL_free(ssl);
}
const rb_data_type_t ossl_ssl_type = {
"OpenSSL/SSL",
{
0, ossl_ssl_free,
},
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
};
static VALUE
ossl_ssl_s_alloc(VALUE klass)
{
return Data_Wrap_Struct(klass, 0, ossl_ssl_free, NULL);
return TypedData_Wrap_Struct(klass, &ossl_ssl_type, NULL);
}
/*

View file

@ -12,7 +12,7 @@
#define _OSSL_SSL_H_
#define GetSSL(obj, ssl) do { \
Data_Get_Struct((obj), SSL, (ssl)); \
TypedData_Get_Struct((obj), SSL, &ossl_ssl_type, (ssl)); \
} while (0)
#define GetSSLSession(obj, sess) do { \
@ -27,6 +27,7 @@
GetSSLSession((obj), (sess)); \
} while (0)
extern const rb_data_type_t ossl_ssl_type;
extern const rb_data_type_t ossl_ssl_session_type;
extern VALUE mSSL;
extern VALUE eSSLError;