diff options
author | Zachary Scott <e@zzak.io> | 2015-06-03 14:02:14 -0400 |
---|---|---|
committer | Zachary Scott <e@zzak.io> | 2015-06-03 14:02:14 -0400 |
commit | 8706e768540ab7d556f1859f71d7ee3c8b40e25d (patch) | |
tree | 53b7f857ccada137d2678adaf0a5408873d35809 /ext/openssl/ossl_x509revoked.c | |
parent | bd594af66966d8ab62e6963540b2caabc0cf3087 (diff) | |
download | ruby-openssl-8706e768540ab7d556f1859f71d7ee3c8b40e25d.tar.gz |
Upstream ruby/ruby@451fe26 from r50673
Diffstat (limited to 'ext/openssl/ossl_x509revoked.c')
-rw-r--r-- | ext/openssl/ossl_x509revoked.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c index 4babb3c1..5c257f4f 100644 --- a/ext/openssl/ossl_x509revoked.c +++ b/ext/openssl/ossl_x509revoked.c @@ -10,11 +10,13 @@ */ #include "ossl.h" -#define WrapX509Rev(klass, obj, rev) do { \ +#define NewX509Rev(klass) \ + TypedData_Wrap_Struct((klass), &ossl_x509rev_type, 0) +#define SetX509Rev(obj, rev) do { \ if (!(rev)) { \ ossl_raise(rb_eRuntimeError, "REV wasn't initialized!"); \ } \ - (obj) = TypedData_Wrap_Struct((klass), &ossl_x509rev_type, (rev)); \ + RTYPEDDATA_DATA(obj) = (rev); \ } while (0) #define GetX509Rev(obj, rev) do { \ TypedData_Get_Struct((obj), X509_REVOKED, &ossl_x509rev_type, (rev)); \ @@ -56,6 +58,7 @@ ossl_x509revoked_new(X509_REVOKED *rev) X509_REVOKED *new; VALUE obj; + obj = NewX509Rev(cX509Rev); if (!rev) { new = X509_REVOKED_new(); } else { @@ -64,7 +67,7 @@ ossl_x509revoked_new(X509_REVOKED *rev) if (!new) { ossl_raise(eX509RevError, NULL); } - WrapX509Rev(cX509Rev, obj, new); + SetX509Rev(obj, new); return obj; } @@ -91,10 +94,11 @@ ossl_x509revoked_alloc(VALUE klass) X509_REVOKED *rev; VALUE obj; + obj = NewX509Rev(klass); if (!(rev = X509_REVOKED_new())) { ossl_raise(eX509RevError, NULL); } - WrapX509Rev(klass, obj, rev); + SetX509Rev(obj, rev); return obj; } |