зеркало из https://github.com/github/ruby.git
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:
Родитель
060e693738
Коммит
cd96afe993
|
@ -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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче