Skip to content

Commit 8d4d444

Browse files
committed
bio: simplify ossl_membio2str() using ossl_str_new()
ossl_membio2str0() and ossl_protect_membio2str() are removed as they aren't used anywhere.
1 parent 1596d19 commit 8d4d444

File tree

2 files changed

+5
-22
lines changed

2 files changed

+5
-22
lines changed

ext/openssl/ossl_bio.c

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,17 @@ ossl_protect_obj2bio(VALUE obj, int *status)
5353
}
5454

5555
VALUE
56-
ossl_membio2str0(BIO *bio)
56+
ossl_membio2str(BIO *bio)
5757
{
5858
VALUE ret;
59+
int state;
5960
BUF_MEM *buf;
6061

6162
BIO_get_mem_ptr(bio, &buf);
62-
ret = rb_str_new(buf->data, buf->length);
63-
64-
return ret;
65-
}
66-
67-
VALUE
68-
ossl_protect_membio2str(BIO *bio, int *status)
69-
{
70-
return rb_protect((VALUE (*)(VALUE))ossl_membio2str0, (VALUE)bio, status);
71-
}
72-
73-
VALUE
74-
ossl_membio2str(BIO *bio)
75-
{
76-
VALUE ret;
77-
int status = 0;
78-
79-
ret = ossl_protect_membio2str(bio, &status);
63+
ret = ossl_str_new(buf->data, buf->length, &state);
8064
BIO_free(bio);
81-
if(status) rb_jump_tag(status);
65+
if (state)
66+
rb_jump_tag(state);
8267

8368
return ret;
8469
}

ext/openssl/ossl_bio.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
BIO *ossl_obj2bio(VALUE);
1414
BIO *ossl_protect_obj2bio(VALUE,int*);
15-
VALUE ossl_membio2str0(BIO*);
1615
VALUE ossl_membio2str(BIO*);
17-
VALUE ossl_protect_membio2str(BIO*,int*);
1816

1917
#endif

0 commit comments

Comments
 (0)