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()
This commit is contained in:
Dr. Stephen Henson
2008-10-22 15:43:01 +00:00
parent ae7ec4c71d
commit e19106f5fb
13 changed files with 70 additions and 86 deletions

View File

@@ -413,7 +413,7 @@ long ssl2_ctx_callback_ctrl(SSL_CTX *ctx, int cmd, void (*fp)(void))
}
IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(SSL_CIPHER, SSL_CIPHER,
ssl_cipher_id_cmp);
ssl_cipher_id);
/* This function needs to check if the ciphers required are actually
* available */
@@ -426,8 +426,7 @@ const SSL_CIPHER *ssl2_get_cipher_by_char(const unsigned char *p)
id=0x02000000L|((unsigned long)p[0]<<16L)|
((unsigned long)p[1]<<8L)|(unsigned long)p[2];
c.id=id;
cp = OBJ_bsearch(const SSL_CIPHER, &c, const SSL_CIPHER, ssl2_ciphers,
SSL2_NUM_CIPHERS, ssl_cipher_id_cmp);
cp = OBJ_bsearch_ssl_cipher_id(&c, ssl2_ciphers, SSL2_NUM_CIPHERS);
if ((cp == NULL) || (cp->valid == 0))
return NULL;
else