summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_ns_spki.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 21:58:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-12-12 21:58:03 +0000
commita6d16bdc0f2ac50e2762cdc20e5726b0d9e8f0dc (patch)
tree4fe2ecea83e40da2f5bd7d4e1e055e63f9189e31 /ext/openssl/ossl_ns_spki.c
parentc5de5573c129284bba0c116bef1c58947895c25f (diff)
ossl_ns_spki.c: typed data
* ext/openssl/ossl_ns_spki.c (ossl_netscape_spki_type): use typed data. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_ns_spki.c')
-rw-r--r--ext/openssl/ossl_ns_spki.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index 965bbe8..d2a52e6 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -14,10 +14,10 @@
if (!(spki)) { \
ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, NETSCAPE_SPKI_free, (spki)); \
+ (obj) = TypedData_Wrap_Struct((klass), &ossl_netscape_spki_type, (spki)); \
} while (0)
#define GetSPKI(obj, spki) do { \
- Data_Get_Struct((obj), NETSCAPE_SPKI, (spki)); \
+ TypedData_Get_Struct((obj), NETSCAPE_SPKI, &ossl_netscape_spki_type, (spki)); \
if (!(spki)) { \
ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
} \
@@ -37,6 +37,21 @@ VALUE eSPKIError;
/*
* Private functions
*/
+
+static void
+ossl_netscape_spki_free(void *spki)
+{
+ NETSCAPE_SPKI_free(spki);
+}
+
+static const rb_data_type_t ossl_netscape_spki_type = {
+ "OpenSSL/NETSCAPE_SPKI",
+ {
+ 0, ossl_netscape_spki_free,
+ },
+ 0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
+};
+
static VALUE
ossl_spki_alloc(VALUE klass)
{