diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2008-10-22 15:43:01 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2008-10-22 15:43:01 +0000 |
commit | e19106f5fb7da7db15449a9a50f9be9047800757 (patch) | |
tree | 0341d860168821112fb47ded07b1f761895c04cd /crypto/evp/pmeth_lib.c | |
parent | ae7ec4c71de74fa52c5d89e32e28445c6602990d (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/evp/pmeth_lib.c')
-rw-r--r-- | crypto/evp/pmeth_lib.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index d1b661ff36..072736719d 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -85,7 +85,7 @@ static const EVP_PKEY_METHOD *standard_methods[] = }; DECLARE_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, - pmeth_cmp); + pmeth); static int pmeth_cmp(const EVP_PKEY_METHOD * const *a, const EVP_PKEY_METHOD * const *b) @@ -94,7 +94,7 @@ static int pmeth_cmp(const EVP_PKEY_METHOD * const *a, } IMPLEMENT_OBJ_BSEARCH_CMP_FN(const EVP_PKEY_METHOD *, const EVP_PKEY_METHOD *, - pmeth_cmp); + pmeth); const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type) { @@ -108,10 +108,8 @@ const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type) if (idx >= 0) return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx); } - ret = OBJ_bsearch(const EVP_PKEY_METHOD *, &t, - const EVP_PKEY_METHOD *, standard_methods, - sizeof(standard_methods)/sizeof(EVP_PKEY_METHOD *), - pmeth_cmp); + ret = OBJ_bsearch_pmeth(&t, standard_methods, + sizeof(standard_methods)/sizeof(EVP_PKEY_METHOD *)); if (!ret || !*ret) return NULL; return *ret; |