mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
22f249ebd7
commit
25c50cd193
43 changed files with 484 additions and 512 deletions
|
@ -124,22 +124,22 @@ ossl_bn_initialize(int argc, VALUE *argv, VALUE self)
|
|||
|
||||
switch (base) {
|
||||
case 0:
|
||||
if (!BN_mpi2bn(RSTRING(str)->ptr, RSTRING(str)->len, bn)) {
|
||||
if (!BN_mpi2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) {
|
||||
ossl_raise(eBNError, NULL);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (!BN_bin2bn(RSTRING(str)->ptr, RSTRING(str)->len, bn)) {
|
||||
if (!BN_bin2bn(RSTRING_PTR(str), RSTRING_LEN(str), bn)) {
|
||||
ossl_raise(eBNError, NULL);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
if (!BN_dec2bn(&bn, RSTRING(str)->ptr)) {
|
||||
if (!BN_dec2bn(&bn, RSTRING_PTR(str))) {
|
||||
ossl_raise(eBNError, NULL);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
if (!BN_hex2bn(&bn, RSTRING(str)->ptr)) {
|
||||
if (!BN_hex2bn(&bn, RSTRING_PTR(str))) {
|
||||
ossl_raise(eBNError, NULL);
|
||||
}
|
||||
break;
|
||||
|
@ -165,13 +165,13 @@ ossl_bn_to_s(int argc, VALUE *argv, VALUE self)
|
|||
case 0:
|
||||
len = BN_bn2mpi(bn, NULL);
|
||||
str = rb_str_new(0, len);
|
||||
if (BN_bn2mpi(bn, RSTRING(str)->ptr) != len)
|
||||
if (BN_bn2mpi(bn, RSTRING_PTR(str)) != len)
|
||||
ossl_raise(eBNError, NULL);
|
||||
break;
|
||||
case 2:
|
||||
len = BN_num_bytes(bn);
|
||||
str = rb_str_new(0, len);
|
||||
if (BN_bn2bin(bn, RSTRING(str)->ptr) != len)
|
||||
if (BN_bn2bin(bn, RSTRING_PTR(str)) != len)
|
||||
ossl_raise(eBNError, NULL);
|
||||
break;
|
||||
case 10:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue