diff options
author | Tomas Mraz <tmraz@fedoraproject.org> | 2020-11-03 18:15:46 +0100 |
---|---|---|
committer | Tomas Mraz <tmraz@fedoraproject.org> | 2020-11-11 16:05:56 +0100 |
commit | 69d16b70cf84f0e290990de424274fde20420b78 (patch) | |
tree | 8ef65500fdd8d76dce2809277fcf59f80bb0141c /providers | |
parent | 122e81f0705e74a2019c482e5122bbd9195ea1af (diff) |
Avoid duplicate ends_with_dirsep functions
Refactor them into inline ossl_ends_with_dirsep function in
internal/cryptlib.h.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13306)
Diffstat (limited to 'providers')
-rw-r--r-- | providers/implementations/storemgmt/file_store.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c index 3b6c50c9e5..5607f169cc 100644 --- a/providers/implementations/storemgmt/file_store.c +++ b/providers/implementations/storemgmt/file_store.c @@ -24,6 +24,7 @@ #include <openssl/params.h> #include <openssl/decoder.h> #include <openssl/store.h> /* The OSSL_STORE_INFO type numbers */ +#include "internal/cryptlib.h" #include "internal/o_dir.h" #include "crypto/pem.h" /* For PVK and "blob" PEM headers */ #include "crypto/decoder.h" @@ -647,27 +648,13 @@ static int file_load_file(struct file_ctx_st *ctx, * -------------------------------------- */ -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 char *file_name_to_uri(struct file_ctx_st *ctx, const char *name) { char *data = NULL; assert(name != 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 */; |