From: Richard Levitte Date: Thu, 29 Jun 2017 19:46:02 +0000 (+0200) Subject: STORE: simplify store_loader_cmp() X-Git-Tag: OpenSSL_1_1_1-pre1~1147 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6f9c5062682c0f30d62af54b15ad6904e4dd8cb6;p=oweals%2Fopenssl.git STORE: simplify store_loader_cmp() We have already made sure that the loader scheme isn't NULL, so checking if they are NULL or not when comparing registered loaders is redundant. We still soft assert it, just to be entirely sure. Reviewed-by: Ben Kaduk (Merged from https://github.com/openssl/openssl/pull/3805) --- diff --git a/crypto/store/store_register.c b/crypto/store/store_register.c index bde190e78e..c7feec39d6 100644 --- a/crypto/store/store_register.c +++ b/crypto/store/store_register.c @@ -123,11 +123,8 @@ static unsigned long store_loader_hash(const OSSL_STORE_LOADER *v) static int store_loader_cmp(const OSSL_STORE_LOADER *a, const OSSL_STORE_LOADER *b) { - if (a->scheme != NULL && b->scheme != NULL) - return strcmp(a->scheme, b->scheme); - else if (a->scheme == b->scheme) - return 0; - return a->scheme == NULL ? -1 : 1; + assert(a->scheme != NULL && b->scheme != NULL); + return strcmp(a->scheme, b->scheme); } static LHASH_OF(OSSL_STORE_LOADER) *loader_register = NULL;