aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_pkcs7.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-03 15:19:20 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-03 15:19:20 +0000
commit33e1c86f8b808e8d505c9a6ddbe9efb357be4d41 (patch)
tree4506fa3a8fc824574f3a066ebfa8bbbaac7cd813 /ext/openssl/ossl_pkcs7.c
parent98630412982590136fe7d252b5697020aa255dbd (diff)
downloadruby-33e1c86f8b808e8d505c9a6ddbe9efb357be4d41.tar.gz
openssl: constify
* ext/openssl/ossl_asn1.c (ossl_asn1_info): constify. * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_sym2typeid): constify and remove sentinel as the count is used. * ext/openssl/ossl_ssl.c (ossl_ssl_method_tab): constify. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47048 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_pkcs7.c')
-rw-r--r--ext/openssl/ossl_pkcs7.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index 23de7dd558..bd5dc78947 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -364,8 +364,8 @@ ossl_pkcs7_sym2typeid(VALUE sym)
const char *s;
size_t l;
- static struct {
- const char *name;
+ static const struct {
+ char name[20];
int nid;
} p7_type_tab[] = {
{ "signed", NID_pkcs7_signed },
@@ -374,14 +374,13 @@ ossl_pkcs7_sym2typeid(VALUE sym)
{ "enveloped", NID_pkcs7_enveloped },
{ "encrypted", NID_pkcs7_encrypted },
{ "digest", NID_pkcs7_digest },
- { NULL, 0 },
};
if (RB_TYPE_P(sym, T_SYMBOL)) sym = rb_sym2str(sym);
else StringValue(sym);
RSTRING_GETMEM(sym, s, l);
- for(i = 0; i < numberof(p7_type_tab); i++){
- if(p7_type_tab[i].name == NULL)
+ for(i = 0; ; i++){
+ if(i == numberof(p7_type_tab))
ossl_raise(ePKCS7Error, "unknown type \"%s\"", s);
if(strlen(p7_type_tab[i].name) != l) continue;
if(strcmp(p7_type_tab[i].name, s) == 0){