aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_ssl_session.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 21:58:25 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 21:58:25 +0000
commitd064e7c8576d311730fb86f1d289a6f95a917134 (patch)
tree3275006ebb21c83167c098eb1d5443c889433775 /ext/openssl/ossl_ssl_session.c
parent457cd40f30593b982d8f8933ab4d62949b372616 (diff)
downloadruby-d064e7c8576d311730fb86f1d289a6f95a917134.tar.gz
ossl_ssl_session.c: typed data
* ext/openssl/ossl_ssl_session.c (ossl_ssl_session_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_ssl_session.c')
-rw-r--r--ext/openssl/ossl_ssl_session.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c
index 089a3ccb2e..5318f1a525 100644
--- a/ext/openssl/ossl_ssl_session.c
+++ b/ext/openssl/ossl_ssl_session.c
@@ -4,25 +4,26 @@
#include "ossl.h"
-#define GetSSLSession(obj, sess) do { \
- Data_Get_Struct((obj), SSL_SESSION, (sess)); \
- if (!(sess)) { \
- ossl_raise(rb_eRuntimeError, "SSL Session wasn't initialized."); \
- } \
-} while (0)
-
-#define SafeGetSSLSession(obj, sess) do { \
- OSSL_Check_Kind((obj), cSSLSession); \
- GetSSLSession((obj), (sess)); \
-} while (0)
-
-
VALUE cSSLSession;
static VALUE eSSLSession;
+static void
+ossl_ssl_session_free(void *ptr)
+{
+ SSL_SESSION_free(ptr);
+}
+
+const rb_data_type_t ossl_ssl_session_type = {
+ "OpenSSL/SSL/Session",
+ {
+ 0, ossl_ssl_session_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
static VALUE ossl_ssl_session_alloc(VALUE klass)
{
- return Data_Wrap_Struct(klass, 0, SSL_SESSION_free, NULL);
+ return TypedData_Wrap_Struct(klass, &ossl_ssl_session_type, NULL);
}
/*