Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions src/pool/pool_scalable.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ static void tbb_raw_free_wrapper(intptr_t pool_id, void *ptr, size_t bytes) {
}

umf_result_t
umfScalablePoolParamsCreate(umf_scalable_pool_params_handle_t *params) {
if (!params) {
umfScalablePoolParamsCreate(umf_scalable_pool_params_handle_t *hParams) {
if (!hParams) {
LOG_ERR("scalable pool params handle is NULL");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}
Expand All @@ -190,28 +190,28 @@ umfScalablePoolParamsCreate(umf_scalable_pool_params_handle_t *params) {
params_data->granularity = DEFAULT_GRANULARITY;
params_data->keep_all_memory = false;

*params = (umf_scalable_pool_params_handle_t)params_data;
*hParams = (umf_scalable_pool_params_handle_t)params_data;

return UMF_RESULT_SUCCESS;
}

umf_result_t
umfScalablePoolParamsDestroy(umf_scalable_pool_params_handle_t params) {
if (!params) {
LOG_ERR("params is NULL");
umfScalablePoolParamsDestroy(umf_scalable_pool_params_handle_t hParams) {
if (!hParams) {
LOG_ERR("scalable pool params handle is NULL");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

umf_ba_global_free(params);
umf_ba_global_free(hParams);

return UMF_RESULT_SUCCESS;
}

umf_result_t
umfScalablePoolParamsSetGranularity(umf_scalable_pool_params_handle_t params,
umfScalablePoolParamsSetGranularity(umf_scalable_pool_params_handle_t hParams,
size_t granularity) {
if (!params) {
LOG_ERR("params is NULL");
if (!hParams) {
LOG_ERR("scalable pool params handle is NULL");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

Expand All @@ -220,20 +220,20 @@ umfScalablePoolParamsSetGranularity(umf_scalable_pool_params_handle_t params,
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

params->granularity = granularity;
hParams->granularity = granularity;

return UMF_RESULT_SUCCESS;
}

umf_result_t
umfScalablePoolParamsSetKeepAllMemory(umf_scalable_pool_params_handle_t params,
bool keep_all_memory) {
if (!params) {
LOG_ERR("params is NULL");
umfScalablePoolParamsSetKeepAllMemory(umf_scalable_pool_params_handle_t hParams,
bool keepAllMemory) {
if (!hParams) {
LOG_ERR("scalable pool params handle is NULL");
return UMF_RESULT_ERROR_INVALID_ARGUMENT;
}

params->keep_all_memory = keep_all_memory;
hParams->keep_all_memory = keepAllMemory;

return UMF_RESULT_SUCCESS;
}
Expand Down
8 changes: 4 additions & 4 deletions test/pools/scalable_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ struct umfScalablePoolParamsTest
struct provider_validator : public umf_test::provider_ba_global {
using base_provider = umf_test::provider_ba_global;

umf_result_t initialize(validation_params_t *params) noexcept {
umf_result_t initialize(validation_params_t *params) {
EXPECT_NE(params, nullptr);
expected_params = params;
return UMF_RESULT_SUCCESS;
}
umf_result_t alloc(size_t size, size_t align, void **ptr) noexcept {
umf_result_t alloc(size_t size, size_t align, void **ptr) {
EXPECT_EQ(size, expected_params->granularity);
return base_provider::alloc(size, align, ptr);
}
umf_result_t free(void *ptr, size_t size) noexcept {
umf_result_t free(void *ptr, size_t size) {
EXPECT_EQ(expected_params->keep_all_memory, false);
return base_provider::free(ptr, size);
}
Expand All @@ -49,7 +49,7 @@ struct umfScalablePoolParamsTest
static constexpr umf_memory_provider_ops_t VALIDATOR_PROVIDER_OPS =
umf::providerMakeCOps<provider_validator, validation_params_t>();

umfScalablePoolParamsTest() {}
umfScalablePoolParamsTest() : expected_params{0, false}, params(nullptr) {}
void SetUp() override {
test::SetUp();
auto [granularity, keep_all_memory] = this->GetParam();
Expand Down
Loading