summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-13 00:06:48 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-13 00:06:48 +0000
commita3fa871534efbacb977cf1bca2e62ec70053c1e1 (patch)
tree64fd6cc9cc5654601984fa9dd124f0ee88cfb1af
parent7db35b0399187f043aa5e5a34ff0815181b0c738 (diff)
ossl_x509store.c: typed data
* ext/openssl/ossl_x509store.c (ossl_x509store_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ext/openssl/ossl_x509store.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c
index dd924bf951..54455bdb72 100644
--- a/ext/openssl/ossl_x509store.c
+++ b/ext/openssl/ossl_x509store.c
@@ -14,10 +14,10 @@
if (!(st)) { \
ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, X509_STORE_free, (st)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_x509store_type, (st)); \
} while (0)
#define GetX509Store(obj, st) do { \
- Data_Get_Struct((obj), X509_STORE, (st)); \
+ TypedData_Get_Struct((obj), X509_STORE, &ossl_x509store_type, (st)); \
if (!(st)) { \
ossl_raise(rb_eRuntimeError, "STORE wasn't initialized!"); \
} \
@@ -51,6 +51,20 @@ VALUE cX509Store;
VALUE cX509StoreContext;
VALUE eX509StoreError;
+static void
+ossl_x509store_free(void *ptr)
+{
+ X509_STORE_free(ptr);
+}
+
+static const rb_data_type_t ossl_x509store_type = {
+ "OpenSSL/X509/STORE",
+ {
+ 0, ossl_x509store_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
/*
* Public functions
*/