diff --git a/examples/dram_and_fsdax/dram_and_fsdax.c b/examples/dram_and_fsdax/dram_and_fsdax.c index ad2d12392a..4486934d98 100644 --- a/examples/dram_and_fsdax/dram_and_fsdax.c +++ b/examples/dram_and_fsdax/dram_and_fsdax.c @@ -96,7 +96,7 @@ int main(void) { // - the UMF_TESTS_FSDAX_PATH environment variable to contain // a path to a file on this FSDAX device. char *path = getenv("UMF_TESTS_FSDAX_PATH"); - if (path == NULL || path[0] == 0) { + if (path == NULL || path[0] == '\0') { fprintf( stderr, "Warning: UMF_TESTS_FSDAX_PATH is not set, skipping testing ...\n"); diff --git a/test/ipc_devdax_prov_consumer.c b/test/ipc_devdax_prov_consumer.c index 760d075c83..105ddd864b 100644 --- a/test/ipc_devdax_prov_consumer.c +++ b/test/ipc_devdax_prov_consumer.c @@ -23,13 +23,13 @@ int main(int argc, char *argv[]) { int port = atoi(argv[1]); char *path = getenv("UMF_TESTS_DEVDAX_PATH"); - if (path == NULL || path[0] == 0) { + if (path == NULL || path[0] == '\0') { fprintf(stderr, "Test skipped, UMF_TESTS_DEVDAX_PATH is not set\n"); return 0; } char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (size == NULL || size[0] == 0) { + if (size == NULL || size[0] == '\0') { fprintf(stderr, "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set\n"); return 0; } diff --git a/test/ipc_devdax_prov_producer.c b/test/ipc_devdax_prov_producer.c index 39d5985990..2445db07ec 100644 --- a/test/ipc_devdax_prov_producer.c +++ b/test/ipc_devdax_prov_producer.c @@ -23,13 +23,13 @@ int main(int argc, char *argv[]) { int port = atoi(argv[1]); char *path = getenv("UMF_TESTS_DEVDAX_PATH"); - if (path == NULL || path[0] == 0) { + if (path == NULL || path[0] == '\0') { fprintf(stderr, "Test skipped, UMF_TESTS_DEVDAX_PATH is not set\n"); return 0; } char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (size == NULL || size[0] == 0) { + if (size == NULL || size[0] == '\0') { fprintf(stderr, "Test skipped, UMF_TESTS_DEVDAX_SIZE is not set\n"); return 0; } diff --git a/test/pools/jemalloc_coarse_devdax.cpp b/test/pools/jemalloc_coarse_devdax.cpp index 8f96739aec..8af7809970 100644 --- a/test/pools/jemalloc_coarse_devdax.cpp +++ b/test/pools/jemalloc_coarse_devdax.cpp @@ -10,7 +10,8 @@ bool devDaxEnvSet() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) { + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { return false; } @@ -20,6 +21,10 @@ bool devDaxEnvSet() { void *createDevDaxParams() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { + return nullptr; + } umf_devdax_memory_provider_params_handle_t params = NULL; umf_result_t res = diff --git a/test/pools/scalable_coarse_devdax.cpp b/test/pools/scalable_coarse_devdax.cpp index 6e27cd909e..83fa855279 100644 --- a/test/pools/scalable_coarse_devdax.cpp +++ b/test/pools/scalable_coarse_devdax.cpp @@ -10,7 +10,8 @@ bool devDaxEnvSet() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) { + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { return false; } @@ -20,6 +21,10 @@ bool devDaxEnvSet() { void *createDevDaxParams() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { + return nullptr; + } umf_devdax_memory_provider_params_handle_t params = NULL; umf_result_t res = diff --git a/test/provider_devdax_memory.cpp b/test/provider_devdax_memory.cpp index b6b3299e01..b22f4fa291 100644 --- a/test/provider_devdax_memory.cpp +++ b/test/provider_devdax_memory.cpp @@ -123,7 +123,7 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) { umf_result_t umf_result; char *path = getenv("UMF_TESTS_DEVDAX_PATH"); - if (path == nullptr || path[0] == 0) { + if (path == nullptr || path[0] == '\0') { GTEST_SKIP() << "Test skipped, UMF_TESTS_DEVDAX_PATH is not set"; } @@ -169,7 +169,8 @@ using devdax_params_unique_handle_t = devdax_params_unique_handle_t create_devdax_params() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) { + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { return devdax_params_unique_handle_t( nullptr, &umfDevDaxMemoryProviderParamsDestroy); } diff --git a/test/provider_devdax_memory_ipc.cpp b/test/provider_devdax_memory_ipc.cpp index dd9452e540..1db7011534 100644 --- a/test/provider_devdax_memory_ipc.cpp +++ b/test/provider_devdax_memory_ipc.cpp @@ -18,7 +18,8 @@ using umf_test::test; bool devDaxEnvSet() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) { + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { return false; } @@ -28,7 +29,8 @@ bool devDaxEnvSet() { void *defaultDevDaxParamsCreate() { char *path = getenv("UMF_TESTS_DEVDAX_PATH"); char *size = getenv("UMF_TESTS_DEVDAX_SIZE"); - if (path == nullptr || path[0] == 0 || size == nullptr || size[0] == 0) { + if (path == nullptr || path[0] == '\0' || size == nullptr || + size[0] == '\0') { return nullptr; } diff --git a/test/provider_file_memory.cpp b/test/provider_file_memory.cpp index 4fae4ce338..c59223eb5a 100644 --- a/test/provider_file_memory.cpp +++ b/test/provider_file_memory.cpp @@ -119,7 +119,7 @@ TEST_F(test, test_if_mapped_with_MAP_SYNC) { umf_result_t umf_result; char *path = getenv("UMF_TESTS_FSDAX_PATH"); - if (path == nullptr || path[0] == 0) { + if (path == nullptr || path[0] == '\0') { GTEST_SKIP() << "Test skipped, UMF_TESTS_FSDAX_PATH is not set"; } diff --git a/test/provider_file_memory_ipc.cpp b/test/provider_file_memory_ipc.cpp index 7864876441..fe50d8408f 100644 --- a/test/provider_file_memory_ipc.cpp +++ b/test/provider_file_memory_ipc.cpp @@ -114,7 +114,7 @@ static std::vector getIpcFsDaxTestParamsList(void) { std::vector ipcFsDaxTestParamsList = {}; char *path = getenv("UMF_TESTS_FSDAX_PATH"); - if (path == nullptr || path[0] == 0) { + if (path == nullptr || path[0] == '\0') { // skipping the test, UMF_TESTS_FSDAX_PATH is not set return ipcFsDaxTestParamsList; }