aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-09-04 16:10:02 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-10-27 16:16:00 +0900
commit47c0ef65cd553864ff236b5e4cd37e4ac8188690 (patch)
tree246ba2dba0a006407461eaecbbc8527f740e335f /ext
parentff850998167e0abf4d6ca2197136fe94da9da18f (diff)
downloadruby-openssl-47c0ef65cd553864ff236b5e4cd37e4ac8188690.tar.gz
ssl: avoid using ossl_exc_new()
Avoid using ossl_exc_new() and rb_exc_raise() but just use ossl_raise(). This simplifies the code with the exactly same effect. ossl_exc_new() is now removed as it is no longer used anywhere.
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl.c11
-rw-r--r--ext/openssl/ossl.h1
-rw-r--r--ext/openssl/ossl_ssl.c12
3 files changed, 4 insertions, 20 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 8c28c714..8ef41385 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -356,17 +356,6 @@ ossl_raise(VALUE exc, const char *fmt, ...)
rb_exc_raise(err);
}
-VALUE
-ossl_exc_new(VALUE exc, const char *fmt, ...)
-{
- va_list args;
- VALUE err;
- va_start(args, fmt);
- err = ossl_make_error(exc, fmt, args);
- va_end(args);
- return err;
-}
-
void
ossl_clear_error(void)
{
diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
index 0400a33d..7172e39a 100644
--- a/ext/openssl/ossl.h
+++ b/ext/openssl/ossl.h
@@ -138,7 +138,6 @@ int ossl_pem_passwd_cb(char *, int, int, void *);
*/
#define OSSL_ErrMsg() ERR_reason_error_string(ERR_get_error())
NORETURN(void ossl_raise(VALUE, const char *, ...));
-VALUE ossl_exc_new(VALUE, const char *, ...);
/* Clear OpenSSL error queue. If dOSSL is set, rb_warn() them. */
void ossl_clear_error(void);
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index 861f820d..4b4f3405 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -1496,19 +1496,15 @@ ossl_ssl_setup(VALUE self)
static void
write_would_block(int nonblock)
{
- if (nonblock) {
- VALUE exc = ossl_exc_new(eSSLErrorWaitWritable, "write would block");
- rb_exc_raise(exc);
- }
+ if (nonblock)
+ ossl_raise(eSSLErrorWaitWritable, "write would block");
}
static void
read_would_block(int nonblock)
{
- if (nonblock) {
- VALUE exc = ossl_exc_new(eSSLErrorWaitReadable, "read would block");
- rb_exc_raise(exc);
- }
+ if (nonblock)
+ ossl_raise(eSSLErrorWaitReadable, "read would block");
}
static int