summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_engine.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 21:57:49 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 21:57:49 +0000
commitb0a379e3b0bd6d04a8ccf1f33a329f9c14b749c1 (patch)
tree7849d88754d21d14bc218228fe4cb3842c389aca /ext/openssl/ossl_engine.c
parentcfa7024e25468adb4da2cfdf48649f05158a142f (diff)
ossl_engine.c: typed data
* ext/openssl/ossl_engine.c (ossl_engine_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48792 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_engine.c')
-rw-r--r--ext/openssl/ossl_engine.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c
index 96bce5e..04b5879 100644
--- a/ext/openssl/ossl_engine.c
+++ b/ext/openssl/ossl_engine.c
@@ -16,10 +16,10 @@
if (!(engine)) { \
ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, ENGINE_free, (engine)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_engine_type, (engine)); \
} while(0)
#define GetEngine(obj, engine) do { \
- Data_Get_Struct((obj), ENGINE, (engine)); \
+ TypedData_Get_Struct((obj), ENGINE, &ossl_engine_type, (engine)); \
if (!(engine)) { \
ossl_raise(rb_eRuntimeError, "ENGINE wasn't initialized."); \
} \
@@ -57,6 +57,20 @@ do{\
}\
}while(0)
+static void
+ossl_engine_free(void *engine)
+{
+ ENGINE_free(engine);
+}
+
+static const rb_data_type_t ossl_engine_type = {
+ "OpenSSL/Engine",
+ {
+ 0, ossl_engine_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/* Document-method: OpenSSL::Engine.load
*
* call-seq: