From 6f9c5062682c0f30d62af54b15ad6904e4dd8cb6 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Thu, 29 Jun 2017 21:46:02 +0200 Subject: [PATCH] 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) --- crypto/store/store_register.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; -- 2.25.1