summaryrefslogtreecommitdiffstats
path: root/crypto/x509v3
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2008-10-22 15:43:01 +0000
committerDr. Stephen Henson <steve@openssl.org>2008-10-22 15:43:01 +0000
commite19106f5fb7da7db15449a9a50f9be9047800757 (patch)
tree0341d860168821112fb47ded07b1f761895c04cd /crypto/x509v3
parentae7ec4c71de74fa52c5d89e32e28445c6602990d (diff)
Create function of the form OBJ_bsearch_xxx() in bsearch typesafe macros
with the appropriate parameters which calls OBJ_bsearch(). A compiler will typically inline this. This avoids the need for cmp_xxx variables and fixes unchecked const issues with CHECKED_PTR_OF()
Diffstat (limited to 'crypto/x509v3')
-rw-r--r--crypto/x509v3/v3_lib.c8
-rw-r--r--crypto/x509v3/v3_purp.c10
2 files changed, 8 insertions, 10 deletions
diff --git a/crypto/x509v3/v3_lib.c b/crypto/x509v3/v3_lib.c
index 3ad5b29afc..dad0c905c2 100644
--- a/crypto/x509v3/v3_lib.c
+++ b/crypto/x509v3/v3_lib.c
@@ -90,9 +90,9 @@ static int ext_cmp(const X509V3_EXT_METHOD * const *a,
}
DECLARE_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *, const X509V3_EXT_METHOD *,
- ext_cmp);
+ ext);
IMPLEMENT_OBJ_BSEARCH_CMP_FN(const X509V3_EXT_METHOD *,
- const X509V3_EXT_METHOD *, ext_cmp);
+ const X509V3_EXT_METHOD *, ext);
const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
{
@@ -101,9 +101,7 @@ const X509V3_EXT_METHOD *X509V3_EXT_get_nid(int nid)
int idx;
if(nid < 0) return NULL;
tmp.ext_nid = nid;
- ret = OBJ_bsearch(const X509V3_EXT_METHOD *, &t,
- const X509V3_EXT_METHOD *, standard_exts,
- STANDARD_EXTENSION_COUNT, ext_cmp);
+ ret = OBJ_bsearch_ext(&t, standard_exts, STANDARD_EXTENSION_COUNT);
if(ret) return *ret;
if(!ext_list) return NULL;
idx = sk_X509V3_EXT_METHOD_find(ext_list, &tmp);
diff --git a/crypto/x509v3/v3_purp.c b/crypto/x509v3/v3_purp.c
index a5d9805ce4..e00c9ec130 100644
--- a/crypto/x509v3/v3_purp.c
+++ b/crypto/x509v3/v3_purp.c
@@ -272,8 +272,8 @@ 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);
+DECLARE_OBJ_BSEARCH_CMP_FN(int, int, nid);
+IMPLEMENT_OBJ_BSEARCH_CMP_FN(int, int, nid);
int X509_supported_extension(X509_EXTENSION *ex)
{
@@ -303,13 +303,13 @@ int X509_supported_extension(X509_EXTENSION *ex)
NID_inhibit_any_policy /* 748 */
};
- const int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex));
+ int ex_nid = OBJ_obj2nid(X509_EXTENSION_get_object(ex));
if (ex_nid == NID_undef)
return 0;
- if (OBJ_bsearch(int, &ex_nid, int, supported_nids,
- sizeof(supported_nids)/sizeof(int), nid_cmp))
+ if (OBJ_bsearch_nid(&ex_nid, supported_nids,
+ sizeof(supported_nids)/sizeof(int)))
return 1;
return 0;
}