From cd96afe99373ed6fd69d6187344ae66813e6468e Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 12 Dec 2014 21:58:34 +0000 Subject: 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 --- ext/openssl/ossl_ssl.c | 12 ++++++++++-- ext/openssl/ossl_ssl.h | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'ext') diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 5ab8ae3fd3..af93252e96 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -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); } /* diff --git a/ext/openssl/ossl_ssl.h b/ext/openssl/ossl_ssl.h index faa5d3678f..0c20b10721 100644 --- a/ext/openssl/ossl_ssl.h +++ b/ext/openssl/ossl_ssl.h @@ -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; -- cgit v1.2.3