summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:30:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-08-31 10:30:33 +0000
commit25c50cd193d89ad0737219142bab191f12b8abe8 (patch)
treea14ada29405880c7f56c615067b6600815f54334 /ext/openssl/ossl.c
parent22f249ebd7a142faacdf5edd7e196bd2149feae5 (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.c')
-rw-r--r--ext/openssl/ossl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index a98f2641cc..4000e8fc58 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -131,7 +131,7 @@ ossl_buf2str(char *buf, int len)
int status = 0;
str = rb_protect((VALUE(*)_((VALUE)))ossl_str_new, len, &status);
- if(!NIL_P(str)) memcpy(RSTRING(str)->ptr, buf, len);
+ if(!NIL_P(str)) memcpy(RSTRING_PTR(str), buf, len);
OPENSSL_free(buf);
if(status) rb_jump_tag(status);
@@ -170,7 +170,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
rflag = flag ? Qtrue : Qfalse;
pass = rb_protect(ossl_pem_passwd_cb0, rflag, &status);
if (status) return -1; /* exception was raised. */
- len = RSTRING(pass)->len;
+ len = RSTRING_LEN(pass);
if (len < 4) { /* 4 is OpenSSL hardcoded limit */
rb_warning("password must be longer than 4 bytes");
continue;
@@ -179,7 +179,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
rb_warning("password must be shorter then %d bytes", max_len-1);
continue;
}
- memcpy(buf, RSTRING(pass)->ptr, len);
+ memcpy(buf, RSTRING_PTR(pass), len);
break;
}
return len;