diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-12 23:59:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-12-12 23:59:28 +0000 |
commit | 0b671673dcf8df629c3054c64e2c8ce5d8df1bd8 (patch) | |
tree | 992f9889e5d282a8781dcee895d65c4389f5d876 /ext/openssl | |
parent | a6eb21f849d304331c1fc8a58b3493e8092617ec (diff) | |
download | ruby-0b671673dcf8df629c3054c64e2c8ce5d8df1bd8.tar.gz |
ossl_x509req.c: typed data
* ext/openssl/ossl_x509req.c (ossl_x509req_type): use typed data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl')
-rw-r--r-- | ext/openssl/ossl_x509req.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c index a7f5dd2048..529b68500c 100644 --- a/ext/openssl/ossl_x509req.c +++ b/ext/openssl/ossl_x509req.c @@ -14,10 +14,10 @@ if (!(req)) { \ ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \ } \ - (obj) = Data_Wrap_Struct((klass), 0, X509_REQ_free, (req)); \ + (obj) = TypedData_Wrap_Struct((klass), &ossl_x509req_type, (req)); \ } while (0) #define GetX509Req(obj, req) do { \ - Data_Get_Struct((obj), X509_REQ, (req)); \ + TypedData_Get_Struct((obj), X509_REQ, &ossl_x509req_type, (req)); \ if (!(req)) { \ ossl_raise(rb_eRuntimeError, "Req wasn't initialized!"); \ } \ @@ -33,6 +33,20 @@ VALUE cX509Req; VALUE eX509ReqError; +static void +ossl_x509req_free(void *ptr) +{ + X509_REQ_free(ptr); +} + +static const rb_data_type_t ossl_x509req_type = { + "OpenSSL/X509/REQ", + { + 0, ossl_x509req_free, + }, + 0, 0, RUBY_TYPED_FREE_IMMEDIATELY, +}; + /* * Public functions */ |