From 2156870525be05f0bd769af141c3f6cff9fff8c4 Mon Sep 17 00:00:00 2001 From: matz Date: Sat, 2 Sep 2006 14:42:08 +0000 Subject: * ruby.h (struct RArray): embed small arrays. (RARRAY_LEN): defined for accessing array members. (RARRAY_PTR): ditto. * array.c: use RARRAY_LEN and RARRAY_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl.c | 2 +- ext/openssl/ossl_ocsp.c | 8 ++++---- ext/openssl/ossl_ssl.c | 8 ++++---- ext/openssl/ossl_x509cert.c | 8 ++++---- ext/openssl/ossl_x509crl.c | 16 ++++++++-------- ext/openssl/ossl_x509req.c | 8 ++++---- ext/openssl/ossl_x509revoked.c | 8 ++++---- 7 files changed, 29 insertions(+), 29 deletions(-) (limited to 'ext/openssl') diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 4000e8fc58..16e93bc939 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -59,7 +59,7 @@ ossl_x509_ary2sk0(VALUE ary) sk = sk_X509_new_null(); if (!sk) ossl_raise(eOSSLError, NULL); - for (i = 0; i < RARRAY(ary)->len; i++) { + for (i = 0; i < RARRAY_LEN(ary); i++) { val = rb_ary_entry(ary, i); if (!rb_obj_is_kind_of(val, cX509Cert)) { sk_X509_pop_free(sk, X509_free); diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c index 45d7c6a67a..aa6bd61b3c 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -461,8 +461,8 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status, if(!NIL_P(ext)){ /* All ary's members should be X509Extension */ Check_Type(ext, T_ARRAY); - for (i = 0; i < RARRAY(ext)->len; i++) - OSSL_Check_Kind(RARRAY(ext)->ptr[i], cX509Ext); + for (i = 0; i < RARRAY_LEN(ext); i++) + OSSL_Check_Kind(RARRAY_PTR(ext)[i], cX509Ext); } error = 0; @@ -490,8 +490,8 @@ ossl_ocspbres_add_status(VALUE self, VALUE cid, VALUE status, X509_EXTENSION *x509ext; sk_X509_EXTENSION_pop_free(single->singleExtensions, X509_EXTENSION_free); single->singleExtensions = NULL; - for(i = 0; i < RARRAY(ext)->len; i++){ - x509ext = DupX509ExtPtr(RARRAY(ext)->ptr[i]); + for(i = 0; i < RARRAY_LEN(ext); i++){ + x509ext = DupX509ExtPtr(RARRAY_PTR(ext)[i]); if(!OCSP_SINGLERESP_add_ext(single, x509ext, -1)){ X509_EXTENSION_free(x509ext); error = 1; diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index 844a461449..d956c908be 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -349,8 +349,8 @@ ossl_sslctx_setup(VALUE self) val = ossl_sslctx_get_client_ca(self); if(!NIL_P(val)){ if(TYPE(val) == T_ARRAY){ - for(i = 0; i < RARRAY(val)->len; i++){ - client_ca = GetX509CertPtr(RARRAY(val)->ptr[i]); + for(i = 0; i < RARRAY_LEN(val); i++){ + client_ca = GetX509CertPtr(RARRAY_PTR(val)[i]); if (!SSL_CTX_add_client_CA(ctx, client_ca)){ /* Copies X509_NAME => FREE it. */ ossl_raise(eSSLError, "SSL_CTX_add_client_CA"); @@ -459,12 +459,12 @@ ossl_sslctx_set_ciphers(VALUE self, VALUE v) return v; else if (TYPE(v) == T_ARRAY) { str = rb_str_new(0, 0); - for (i = 0; i < RARRAY(v)->len; i++) { + for (i = 0; i < RARRAY_LEN(v); i++) { elem = rb_ary_entry(v, i); if (TYPE(elem) == T_ARRAY) elem = rb_ary_entry(elem, 0); elem = rb_String(elem); rb_str_append(str, elem); - if (i < RARRAY(v)->len-1) rb_str_cat2(str, ":"); + if (i < RARRAY_LEN(v)-1) rb_str_cat2(str, ":"); } } else { str = v; diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c index f613c800e1..0276764f83 100644 --- a/ext/openssl/ossl_x509cert.c +++ b/ext/openssl/ossl_x509cert.c @@ -557,14 +557,14 @@ ossl_x509_set_extensions(VALUE self, VALUE ary) Check_Type(ary, T_ARRAY); /* All ary's members should be X509Extension */ - for (i=0; ilen; i++) { - OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Ext); + for (i=0; icert_info->extensions, X509_EXTENSION_free); x509->cert_info->extensions = NULL; - for (i=0; ilen; i++) { - ext = DupX509ExtPtr(RARRAY(ary)->ptr[i]); + for (i=0; ilen; i++) { - OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Rev); + for (i=0; icrl->revoked, X509_REVOKED_free); crl->crl->revoked = NULL; - for (i=0; ilen; i++) { - rev = DupX509RevokedPtr(RARRAY(ary)->ptr[i]); + for (i=0; ilen; i++) { - OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Ext); + for (i=0; icrl->extensions, X509_EXTENSION_free); crl->crl->extensions = NULL; - for (i=0; ilen; i++) { - ext = DupX509ExtPtr(RARRAY(ary)->ptr[i]); + for (i=0; ilen; i++) { - OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Attr); + for (i=0;ireq_info->attributes, X509_ATTRIBUTE_free); req->req_info->attributes = NULL; - for (i=0;ilen; i++) { - item = RARRAY(ary)->ptr[i]; + for (i=0;ilen; i++) { - OSSL_Check_Kind(RARRAY(ary)->ptr[i], cX509Ext); + for (i=0; iextensions, X509_EXTENSION_free); rev->extensions = NULL; - for (i=0; ilen; i++) { - item = RARRAY(ary)->ptr[i]; + for (i=0; i