From 69d16b70cf84f0e290990de424274fde20420b78 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Tue, 3 Nov 2020 18:15:46 +0100 Subject: Avoid duplicate ends_with_dirsep functions Refactor them into inline ossl_ends_with_dirsep function in internal/cryptlib.h. Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/13306) --- engines/e_loader_attic.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'engines') diff --git a/engines/e_loader_attic.c b/engines/e_loader_attic.c index 4f238b9cb2..176c159c8c 100644 --- a/engines/e_loader_attic.c +++ b/engines/e_loader_attic.c @@ -1424,27 +1424,13 @@ static int file_read_asn1(BIO *bp, unsigned char **data, long *len) return 1; } -static int ends_with_dirsep(const char *uri) -{ - if (*uri != '\0') - uri += strlen(uri) - 1; -#if defined(__VMS) - if (*uri == ']' || *uri == '>' || *uri == ':') - return 1; -#elif defined(_WIN32) - if (*uri == '\\') - return 1; -#endif - return *uri == '/'; -} - static int file_name_to_uri(OSSL_STORE_LOADER_CTX *ctx, const char *name, char **data) { assert(name != NULL); assert(data != NULL); { - const char *pathsep = ends_with_dirsep(ctx->uri) ? "" : "/"; + const char *pathsep = ossl_ends_with_dirsep(ctx->uri) ? "" : "/"; long calculated_length = strlen(ctx->uri) + strlen(pathsep) + strlen(name) + 1 /* \0 */; -- cgit v1.2.3