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_rand.c | |
parent | 22f249ebd7a142faacdf5edd7e196bd2149feae5 (diff) | |
download | ruby-25c50cd193d89ad0737219142bab191f12b8abe8.tar.gz |
* 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_rand.c')
-rw-r--r-- | ext/openssl/ossl_rand.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c index ec9883d70a..a4247ec013 100644 --- a/ext/openssl/ossl_rand.c +++ b/ext/openssl/ossl_rand.c @@ -31,7 +31,7 @@ static VALUE ossl_rand_seed(VALUE self, VALUE str) { StringValue(str); - RAND_seed(RSTRING(str)->ptr, RSTRING(str)->len); + RAND_seed(RSTRING_PTR(str), RSTRING_LEN(str)); return str; } @@ -41,7 +41,7 @@ ossl_rand_load_file(VALUE self, VALUE filename) { SafeStringValue(filename); - if(!RAND_load_file(RSTRING(filename)->ptr, -1)) { + if(!RAND_load_file(RSTRING_PTR(filename), -1)) { ossl_raise(eRandomError, NULL); } return Qtrue; @@ -51,7 +51,7 @@ static VALUE ossl_rand_write_file(VALUE self, VALUE filename) { SafeStringValue(filename); - if (RAND_write_file(RSTRING(filename)->ptr) == -1) { + if (RAND_write_file(RSTRING_PTR(filename)) == -1) { ossl_raise(eRandomError, NULL); } return Qtrue; @@ -63,7 +63,7 @@ ossl_rand_bytes(VALUE self, VALUE len) VALUE str; str = rb_str_new(0, FIX2INT(len)); - if (!RAND_bytes(RSTRING(str)->ptr, FIX2INT(len))) { + if (!RAND_bytes(RSTRING_PTR(str), FIX2INT(len))) { ossl_raise(eRandomError, NULL); } @@ -76,7 +76,7 @@ ossl_rand_pseudo_bytes(VALUE self, VALUE len) VALUE str; str = rb_str_new(0, FIX2INT(len)); - if (!RAND_pseudo_bytes(RSTRING(str)->ptr, FIX2INT(len))) { + if (!RAND_pseudo_bytes(RSTRING_PTR(str), FIX2INT(len))) { ossl_raise(eRandomError, NULL); } @@ -88,7 +88,7 @@ ossl_rand_egd(VALUE self, VALUE filename) { SafeStringValue(filename); - if(!RAND_egd(RSTRING(filename)->ptr)) { + if(!RAND_egd(RSTRING_PTR(filename))) { ossl_raise(eRandomError, NULL); } return Qtrue; @@ -99,7 +99,7 @@ ossl_rand_egd_bytes(VALUE self, VALUE filename, VALUE len) { SafeStringValue(filename); - if (!RAND_egd_bytes(RSTRING(filename)->ptr, FIX2INT(len))) { + if (!RAND_egd_bytes(RSTRING_PTR(filename), FIX2INT(len))) { ossl_raise(eRandomError, NULL); } return Qtrue; |