diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-31 10:30:33 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2006-08-31 10:30:33 +0000 |
commit | 25c50cd193d89ad0737219142bab191f12b8abe8 (patch) | |
tree | a14ada29405880c7f56c615067b6600815f54334 /ext/openssl/ossl_ssl.c | |
parent | 22f249ebd7a142faacdf5edd7e196bd2149feae5 (diff) |
* ruby.h (struct RString): embed small strings.
(RSTRING_LEN): defined for accessing string members.
(RSTRING_PTR): ditto.
* string.c: use RSTRING_LEN and RSTRING_PTR.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10809 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_ssl.c')
-rw-r--r-- | ext/openssl/ossl_ssl.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 963b05c5e2..844a461449 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -394,8 +394,8 @@ ossl_sslctx_setup(VALUE self) val = ossl_sslctx_get_sess_id_ctx(self); if (!NIL_P(val)){ StringValue(val); - if (!SSL_CTX_set_session_id_context(ctx, RSTRING(val)->ptr, - RSTRING(val)->len)){ + if (!SSL_CTX_set_session_id_context(ctx, RSTRING_PTR(val), + RSTRING_LEN(val))){ ossl_raise(eSSLError, "SSL_CTX_set_session_id_context:"); } } @@ -476,7 +476,7 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v) ossl_raise(eSSLError, "SSL_CTX is not initialized."); return Qnil; } - if (!SSL_CTX_set_cipher_list(ctx, RSTRING(str)->ptr)) { + if (!SSL_CTX_set_cipher_list(ctx, RSTRING_PTR(str))) { ossl_raise(eSSLError, "SSL_CTX_set_cipher_list:"); } @@ -635,7 +635,7 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self) if(SSL_pending(ssl) <= 0) rb_thread_wait_fd(fptr->fd); for (;;){ - nread = SSL_read(ssl, RSTRING(str)->ptr, RSTRING(str)->len); + nread = SSL_read(ssl, RSTRING_PTR(str), RSTRING_LEN(str)); switch(ssl_get_error(ssl, nread)){ case SSL_ERROR_NONE: goto end; @@ -662,8 +662,7 @@ ossl_ssl_read(int argc, VALUE *argv, VALUE self) } end: - RSTRING(str)->len = nread; - RSTRING(str)->ptr[nread] = 0; + rb_str_set_len(str, nread); OBJ_TAINT(str); return str; @@ -682,7 +681,7 @@ ossl_ssl_write(VALUE self, VALUE str) if (ssl) { for (;;){ - nwrite = SSL_write(ssl, RSTRING(str)->ptr, RSTRING(str)->len); + nwrite = SSL_write(ssl, RSTRING_PTR(str), RSTRING_LEN(str)); switch(ssl_get_error(ssl, nwrite)){ case SSL_ERROR_NONE: goto end; |