summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_x509attr.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_x509attr.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_x509attr.c')
-rw-r--r--ext/openssl/ossl_x509attr.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
index 7b88e29..267bd81 100644
--- a/ext/openssl/ossl_x509attr.c
+++ b/ext/openssl/ossl_x509attr.c
@@ -95,9 +95,9 @@ ossl_x509attr_initialize(int argc, VALUE *argv, VALUE self)
if(rb_scan_args(argc, argv, "11", &oid, &value) == 1){
oid = ossl_to_der_if_possible(oid);
StringValue(oid);
- p = RSTRING(oid)->ptr;
+ p = RSTRING_PTR(oid);
if(!d2i_X509_ATTRIBUTE((X509_ATTRIBUTE**)&DATA_PTR(self),
- &p, RSTRING(oid)->len)){
+ &p, RSTRING_LEN(oid))){
ossl_raise(eX509AttrError, NULL);
}
return self;
@@ -192,7 +192,7 @@ ossl_x509attr_get_value(VALUE self)
if(OSSL_X509ATTR_IS_SINGLE(attr)){
length = i2d_ASN1_TYPE(attr->value.single, NULL);
str = rb_str_new(0, length);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
i2d_ASN1_TYPE(attr->value.single, &p);
ossl_str_adjust(str, p);
}
@@ -200,7 +200,7 @@ ossl_x509attr_get_value(VALUE self)
length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL,
i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
str = rb_str_new(0, length);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
ossl_str_adjust(str, p);
@@ -222,10 +222,10 @@ ossl_x509attr_to_der(VALUE self)
if((len = i2d_X509_ATTRIBUTE(attr, NULL)) <= 0)
ossl_raise(eX509AttrError, NULL);
str = rb_str_new(0, len);
- p = RSTRING(str)->ptr;
+ p = RSTRING_PTR(str);
if(i2d_X509_ATTRIBUTE(attr, &p) <= 0)
ossl_raise(eX509AttrError, NULL);
- RSTRING(str)->len = p - (unsigned char*)RSTRING(str)->ptr;
+ rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str));
return str;
}