From 25c50cd193d89ad0737219142bab191f12b8abe8 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 31 Aug 2006 10:30:33 +0000 Subject: * 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 --- ext/openssl/ossl_rand.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'ext/openssl/ossl_rand.c') 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; -- cgit v1.2.3