summaryrefslogtreecommitdiff
path: root/ext/openssl
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 22:37:53 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 22:37:53 +0000
commit374fe20e4f463ff4e3b1b17eaddcb9512d568e2b (patch)
treed7af2d6292ed3de3bdc3a939ae085fefe5fea62d /ext/openssl
parentcd96afe99373ed6fd69d6187344ae66813e6468e (diff)
ossl_pkcs12.c: typed data
* ext/openssl/ossl_pkcs12.c (ossl_pkcs12_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r--ext/openssl/ossl_pkcs12.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c
index b3974cb78c..53e0e619ca 100644
--- a/ext/openssl/ossl_pkcs12.c
+++ b/ext/openssl/ossl_pkcs12.c
@@ -7,11 +7,11 @@
#define WrapPKCS12(klass, obj, p12) do { \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS12_free, (p12)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs12_type, (p12)); \
} while (0)
#define GetPKCS12(obj, p12) do { \
- Data_Get_Struct((obj), PKCS12, (p12)); \
+ TypedData_Get_Struct((obj), PKCS12, &ossl_pkcs12_type, (p12)); \
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
} while (0)
@@ -36,6 +36,20 @@ VALUE ePKCS12Error;
/*
* Private
*/
+static void
+ossl_pkcs12_free(void *ptr)
+{
+ PKCS12_free(ptr);
+}
+
+static const rb_data_type_t ossl_pkcs12_type = {
+ "OpenSSL/PKCS12",
+ {
+ 0, ossl_pkcs12_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
static VALUE
ossl_pkcs12_s_allocate(VALUE klass)
{