diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-12-12 23:53:48 +0900 |
---|---|---|
committer | Kazuki Yamaguchi <k@rhe.jp> | 2017-05-22 10:03:58 +0900 |
commit | 8d4d444917aff23c212e3165132d130cd280b72c (patch) | |
tree | e037c1b6999ade8b394c265f69d0c2258c796759 /ext/openssl/ossl_bio.c | |
parent | 1596d19f0f3042e2022aec5aeae5afbb7df01386 (diff) | |
download | ruby-openssl-8d4d444917aff23c212e3165132d130cd280b72c.tar.gz |
bio: simplify ossl_membio2str() using ossl_str_new()
ossl_membio2str0() and ossl_protect_membio2str() are removed as they
aren't used anywhere.
Diffstat (limited to 'ext/openssl/ossl_bio.c')
-rw-r--r-- | ext/openssl/ossl_bio.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c index 6b7afb56..11cd1cd5 100644 --- a/ext/openssl/ossl_bio.c +++ b/ext/openssl/ossl_bio.c @@ -53,32 +53,17 @@ ossl_protect_obj2bio(VALUE obj, int *status) } VALUE -ossl_membio2str0(BIO *bio) +ossl_membio2str(BIO *bio) { VALUE ret; + int state; BUF_MEM *buf; BIO_get_mem_ptr(bio, &buf); - ret = rb_str_new(buf->data, buf->length); - - return ret; -} - -VALUE -ossl_protect_membio2str(BIO *bio, int *status) -{ - return rb_protect((VALUE (*)(VALUE))ossl_membio2str0, (VALUE)bio, status); -} - -VALUE -ossl_membio2str(BIO *bio) -{ - VALUE ret; - int status = 0; - - ret = ossl_protect_membio2str(bio, &status); + ret = ossl_str_new(buf->data, buf->length, &state); BIO_free(bio); - if(status) rb_jump_tag(status); + if (state) + rb_jump_tag(state); return ret; } |