diff options
author | Ben Laurie <ben@openssl.org> | 2008-10-12 14:32:47 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2008-10-12 14:32:47 +0000 |
commit | babb379849ffb4112792f266f92e9ebb2bd35332 (patch) | |
tree | d401aa7a4af8cc1180fe602711897a50d8feb74f /crypto/x509v3/v3_purp.c | |
parent | 6665ef303e837ed45654d1b5dd42123e7a51b0f4 (diff) | |
download | openssl-babb379849ffb4112792f266f92e9ebb2bd35332.zip openssl-babb379849ffb4112792f266f92e9ebb2bd35332.tar.gz openssl-babb379849ffb4112792f266f92e9ebb2bd35332.tar.bz2 |
Type-checked (and modern C compliant) OBJ_bsearch.
Diffstat (limited to 'crypto/x509v3/v3_purp.c')
-rw-r--r-- | crypto/x509v3/v3_purp.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crypto/x509v3/v3_purp.c b/crypto/x509v3/v3_purp.c index 1ca370d..a5d9805 100644 --- a/crypto/x509v3/v3_purp.c +++ b/crypto/x509v3/v3_purp.c @@ -267,11 +267,14 @@ int X509_PURPOSE_get_trust(X509_PURPOSE *xp) return xp->trust; } -static int nid_cmp(int *a, int *b) +static int nid_cmp(const int *a, const int *b) { return *a - *b; } +DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid_cmp); +IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid_cmp); + int X509_supported_extension(X509_EXTENSION *ex) { /* This table is a list of the NIDs of supported extensions: @@ -282,7 +285,7 @@ int X509_supported_extension(X509_EXTENSION *ex) * searched using bsearch. */ - static int supported_nids[] = { + static const int supported_nids[] = { NID_netscape_cert_type, /* 71 */ NID_key_usage, /* 83 */ NID_subject_alt_name, /* 85 */ @@ -300,16 +303,13 @@ int X509_supported_extension(X509_EXTENSION *ex) NID_inhibit_any_policy /* 748 */ }; - int ex_nid; - - ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); + const int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex)); if (ex_nid == NID_undef) return 0; - if (OBJ_bsearch((char *)&ex_nid, (char *)supported_nids, - sizeof(supported_nids)/sizeof(int), sizeof(int), - (int (*)(const void *, const void *))nid_cmp)) + if (OBJ_bsearch(int, &ex_nid, int, supported_nids, + sizeof(supported_nids)/sizeof(int), nid_cmp)) return 1; return 0; } |