Skip to content

ensure that out paramenter is last function argument #1408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2025
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
6 changes: 3 additions & 3 deletions benchmark/benchmark_umf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ struct fixed_provider : public provider_interface {
provider_interface::params_ptr
getParams(::benchmark::State &state) override {
umf_fixed_memory_provider_params_handle_t raw_params = nullptr;
umfFixedMemoryProviderParamsCreate(&raw_params, mem, size);
umfFixedMemoryProviderParamsCreate(mem, size, &raw_params);
if (!raw_params) {
state.SkipWithError("Failed to create fixed provider params");
return {nullptr, [](void *) {}};
Expand Down Expand Up @@ -351,8 +351,8 @@ struct disjoint_pool_stack : public disjoint_pool<Provider> {
pools.push_back(rootPool); // root pool

umf_fixed_memory_provider_params_handle_t params_fixed = nullptr;
umf_result = umfFixedMemoryProviderParamsCreate(
&params_fixed, (void *)0x1, 0x1); // dummy
umf_result = umfFixedMemoryProviderParamsCreate((void *)0x1, 0x1,
&params_fixed); // dummy

size_t poolSize = firstPoolSize;
size_t level_start = 0;
Expand Down
2 changes: 1 addition & 1 deletion examples/dram_and_fsdax/dram_and_fsdax.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static umf_memory_pool_handle_t create_fsdax_pool(const char *path) {
umf_result_t umf_result;

umf_file_memory_provider_params_handle_t params_fsdax = NULL;
umf_result = umfFileMemoryProviderParamsCreate(&params_fsdax, path);
umf_result = umfFileMemoryProviderParamsCreate(path, &params_fsdax);
if (umf_result != UMF_RESULT_SUCCESS) {
fprintf(stderr, "Failed to create the File Memory Provider params");
return NULL;
Expand Down
8 changes: 4 additions & 4 deletions include/umf/providers/provider_devdax_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef UMF_DEVDAX_MEMORY_PROVIDER_H
#define UMF_DEVDAX_MEMORY_PROVIDER_H

#include <umf/providers/provider_os_memory.h>
#include <umf/memory_provider.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -24,13 +24,13 @@ typedef struct umf_devdax_memory_provider_params_t
*umf_devdax_memory_provider_params_handle_t;

/// @brief Create a struct to store parameters of the Devdax Memory Provider.
/// @param hParams [out] handle to the newly created parameters struct.
/// @param path [in] path of the device DAX.
/// @param size [in] size of the device DAX in bytes.
/// @param hParams [out] handle to the newly created parameters struct.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfDevDaxMemoryProviderParamsCreate(
umf_devdax_memory_provider_params_handle_t *hParams, const char *path,
size_t size);
const char *path, size_t size,
umf_devdax_memory_provider_params_handle_t *hParams);

/// @brief Destroy parameters struct.
/// @param hParams [in] handle to the parameters of the Devdax Memory Provider.
Expand Down
6 changes: 3 additions & 3 deletions include/umf/providers/provider_file_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef UMF_FILE_MEMORY_PROVIDER_H
#define UMF_FILE_MEMORY_PROVIDER_H

#include <umf/providers/provider_os_memory.h>
#include <umf/memory_provider.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -24,11 +24,11 @@ typedef struct umf_file_memory_provider_params_t
*umf_file_memory_provider_params_handle_t;

/// @brief Create a struct to store parameters of the File Memory Provider.
/// @param hParams [out] handle to the newly created parameters struct.
/// @param path path to the file.
/// @param hParams [out] handle to the newly created parameters struct.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFileMemoryProviderParamsCreate(
umf_file_memory_provider_params_handle_t *hParams, const char *path);
const char *path, umf_file_memory_provider_params_handle_t *hParams);

/// @brief Destroy parameters struct.
/// @param hParams handle to the parameters of the File Memory Provider.
Expand Down
6 changes: 3 additions & 3 deletions include/umf/providers/provider_fixed_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#ifndef UMF_FIXED_MEMORY_PROVIDER_H
#define UMF_FIXED_MEMORY_PROVIDER_H

#include <umf/providers/provider_os_memory.h>
#include <umf/memory_provider.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -24,12 +24,12 @@ typedef struct umf_fixed_memory_provider_params_t
*umf_fixed_memory_provider_params_handle_t;

/// @brief Create a struct to store parameters of the Fixed Memory Provider.
/// @param hParams [out] handle to the newly created parameters struct.
/// @param ptr [in] pointer to the memory region.
/// @param size [in] size of the memory region in bytes.
/// @param hParams [out] handle to the newly created parameters struct.
/// @return UMF_RESULT_SUCCESS on success or appropriate error code on failure.
umf_result_t umfFixedMemoryProviderParamsCreate(
umf_fixed_memory_provider_params_handle_t *hParams, void *ptr, size_t size);
void *ptr, size_t size, umf_fixed_memory_provider_params_handle_t *hParams);

/// @brief Set the memory region in params struct. Overwrites the previous value.
/// It provides an ability to use the same instance of params to create multiple
Expand Down
2 changes: 1 addition & 1 deletion include/umf/providers/provider_os_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#ifndef UMF_OS_MEMORY_PROVIDER_H
#define UMF_OS_MEMORY_PROVIDER_H

#include "umf/memory_provider.h"
#include <umf/memory_provider.h>

#ifdef __cplusplus
extern "C" {
Expand Down
8 changes: 4 additions & 4 deletions src/provider/provider_devdax_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ const umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) {
}

umf_result_t umfDevDaxMemoryProviderParamsCreate(
umf_devdax_memory_provider_params_handle_t *hParams, const char *path,
size_t size) {
const char *path, size_t size,
umf_devdax_memory_provider_params_handle_t *hParams) {
(void)hParams;
(void)path;
(void)size;
Expand Down Expand Up @@ -562,8 +562,8 @@ const umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) {
}

umf_result_t umfDevDaxMemoryProviderParamsCreate(
umf_devdax_memory_provider_params_handle_t *hParams, const char *path,
size_t size) {
const char *path, size_t size,
umf_devdax_memory_provider_params_handle_t *hParams) {
libumfInit();
if (hParams == NULL) {
LOG_ERR("DevDax Memory Provider params handle is NULL");
Expand Down
4 changes: 2 additions & 2 deletions src/provider/provider_file_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) {
}

umf_result_t umfFileMemoryProviderParamsCreate(
umf_file_memory_provider_params_handle_t *hParams, const char *path) {
const char *path, umf_file_memory_provider_params_handle_t *hParams) {
(void)hParams;
(void)path;
LOG_ERR("File memory provider is disabled!");
Expand Down Expand Up @@ -889,7 +889,7 @@ const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) {
}

umf_result_t umfFileMemoryProviderParamsCreate(
umf_file_memory_provider_params_handle_t *hParams, const char *path) {
const char *path, umf_file_memory_provider_params_handle_t *hParams) {
libumfInit();
if (hParams == NULL) {
LOG_ERR("File Memory Provider params handle is NULL");
Expand Down
4 changes: 2 additions & 2 deletions src/provider/provider_fixed_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,8 @@ const umf_memory_provider_ops_t *umfFixedMemoryProviderOps(void) {
}

umf_result_t umfFixedMemoryProviderParamsCreate(
umf_fixed_memory_provider_params_handle_t *hParams, void *ptr,
size_t size) {
void *ptr, size_t size,
umf_fixed_memory_provider_params_handle_t *hParams) {
libumfInit();
if (hParams == NULL) {
LOG_ERR("Memory Provider params handle is NULL");
Expand Down
2 changes: 1 addition & 1 deletion test/ctl/ctl_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Pool {

data = malloc(1024 * 1024);
int ret =
umfFixedMemoryProviderParamsCreate(&params, data, 1024 * 1024);
umfFixedMemoryProviderParamsCreate(data, 1024 * 1024, &params);
if (ret != UMF_RESULT_SUCCESS) {
return 0;
}
Expand Down
6 changes: 3 additions & 3 deletions test/disjoint_pool_file_prov.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ TEST_P(FileWithMemoryStrategyTest, disjointFileMallocPool_simple1) {
ASSERT_NE(malloc_memory_provider, nullptr);

umf_file_memory_provider_params_handle_t file_params = nullptr;
umf_result = umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH);
umf_result = umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);
ASSERT_NE(file_params, nullptr);

Expand Down Expand Up @@ -147,7 +147,7 @@ TEST_P(FileWithMemoryStrategyTest, disjointFileMallocPool_simple2) {
ASSERT_NE(malloc_memory_provider, nullptr);

umf_file_memory_provider_params_handle_t file_params = nullptr;
umf_result = umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH);
umf_result = umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);
ASSERT_NE(file_params, nullptr);

Expand Down Expand Up @@ -238,7 +238,7 @@ TEST_P(FileWithMemoryStrategyTest, disjointFileMMapPool_random) {
const unsigned char alloc_check_val = 11;

umf_file_memory_provider_params_handle_t file_params = nullptr;
umf_result = umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH);
umf_result = umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);
ASSERT_NE(file_params, nullptr);

Expand Down
4 changes: 2 additions & 2 deletions test/ipc_devdax_prov_consumer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {

umf_devdax_memory_provider_params_handle_t devdax_params = NULL;
umf_result_t umf_result =
umfDevDaxMemoryProviderParamsCreate(&devdax_params, path, atol(size));
umfDevDaxMemoryProviderParamsCreate(path, atol(size), &devdax_params);
if (umf_result != UMF_RESULT_SUCCESS) {
fprintf(stderr, "[consumer] ERROR: creating DevDax Memory Provider "
"params failed\n");
Expand Down
4 changes: 2 additions & 2 deletions test/ipc_devdax_prov_producer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -36,7 +36,7 @@ int main(int argc, char *argv[]) {

umf_devdax_memory_provider_params_handle_t devdax_params = NULL;
umf_result_t umf_result =
umfDevDaxMemoryProviderParamsCreate(&devdax_params, path, atol(size));
umfDevDaxMemoryProviderParamsCreate(path, atol(size), &devdax_params);
if (umf_result != UMF_RESULT_SUCCESS) {
fprintf(stderr, "[producer] ERROR: creating DevDax Memory Provider "
"params failed\n");
Expand Down
4 changes: 2 additions & 2 deletions test/ipc_file_prov_consumer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {

umf_file_memory_provider_params_handle_t file_params = NULL;
umf_result_t umf_result =
umfFileMemoryProviderParamsCreate(&file_params, file_name);
umfFileMemoryProviderParamsCreate(file_name, &file_params);
if (umf_result != UMF_RESULT_SUCCESS) {
fprintf(
stderr,
Expand Down
4 changes: 2 additions & 2 deletions test/ipc_file_prov_producer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
Expand Down Expand Up @@ -28,7 +28,7 @@ int main(int argc, char *argv[]) {

umf_file_memory_provider_params_handle_t file_params = NULL;
umf_result_t umf_result =
umfFileMemoryProviderParamsCreate(&file_params, file_name);
umfFileMemoryProviderParamsCreate(file_name, &file_params);
if (umf_result != UMF_RESULT_SUCCESS) {
fprintf(
stderr,
Expand Down
8 changes: 4 additions & 4 deletions test/poolFixtures.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -610,8 +610,8 @@ TEST_P(umfPoolTest, pool_from_ptr_whole_size_success) {
// Create provider parameters
size_of_pool_from_ptr = size_of_first_alloc; // whole size
umf_fixed_memory_provider_params_handle_t params = nullptr;
umf_result = umfFixedMemoryProviderParamsCreate(&params, ptr_for_pool,
size_of_pool_from_ptr);
umf_result = umfFixedMemoryProviderParamsCreate(
ptr_for_pool, size_of_pool_from_ptr, &params);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);
ASSERT_NE(params, nullptr);

Expand Down Expand Up @@ -667,8 +667,8 @@ TEST_P(umfPoolTest, pool_from_ptr_half_size_success) {
// Create provider parameters
size_of_pool_from_ptr = size_of_first_alloc / 2; // half size
umf_fixed_memory_provider_params_handle_t params = nullptr;
umf_result = umfFixedMemoryProviderParamsCreate(&params, ptr_for_pool,
size_of_pool_from_ptr);
umf_result = umfFixedMemoryProviderParamsCreate(
ptr_for_pool, size_of_pool_from_ptr, &params);
ASSERT_EQ(umf_result, UMF_RESULT_SUCCESS);
ASSERT_NE(params, nullptr);

Expand Down
2 changes: 1 addition & 1 deletion test/pools/jemalloc_coarse_devdax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void *createDevDaxParams() {

umf_devdax_memory_provider_params_handle_t params = NULL;
umf_result_t res =
umfDevDaxMemoryProviderParamsCreate(&params, path, atol(size));
umfDevDaxMemoryProviderParamsCreate(path, atol(size), &params);
if (res != UMF_RESULT_SUCCESS) {
throw std::runtime_error(
"Failed to create DevDax Memory Provider params");
Expand Down
2 changes: 1 addition & 1 deletion test/pools/jemalloc_coarse_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
void *getFileParamsDefault() {
umf_file_memory_provider_params_handle_t file_params = NULL;
umf_result_t res =
umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH);
umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params);
if (res != UMF_RESULT_SUCCESS) {
throw std::runtime_error(
"Failed to create File Memory Provider params");
Expand Down
4 changes: 2 additions & 2 deletions test/pools/jemalloc_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ void *createFixedMemoryProviderParams() {
}

umf_fixed_memory_provider_params_handle_t params = nullptr;
umf_result_t res = umfFixedMemoryProviderParamsCreate(
&params, memory_buffer.get(), memory_size);
umf_result_t res = umfFixedMemoryProviderParamsCreate(memory_buffer.get(),
memory_size, &params);
if (res != UMF_RESULT_SUCCESS) {
throw std::runtime_error(
"Failed to create Fixed memory provider params");
Expand Down
2 changes: 1 addition & 1 deletion test/pools/scalable_coarse_devdax.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void *createDevDaxParams() {

umf_devdax_memory_provider_params_handle_t params = NULL;
umf_result_t res =
umfDevDaxMemoryProviderParamsCreate(&params, path, atol(size));
umfDevDaxMemoryProviderParamsCreate(path, atol(size), &params);
if (res != UMF_RESULT_SUCCESS) {
throw std::runtime_error(
"Failed to create DevDax Memory Provider params");
Expand Down
2 changes: 1 addition & 1 deletion test/pools/scalable_coarse_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
void *getFileParamsDefault() {
umf_file_memory_provider_params_handle_t file_params = NULL;
umf_result_t res =
umfFileMemoryProviderParamsCreate(&file_params, FILE_PATH);
umfFileMemoryProviderParamsCreate(FILE_PATH, &file_params);
if (res != UMF_RESULT_SUCCESS) {
throw std::runtime_error(
"Failed to create File Memory Provider params");
Expand Down
Loading
Loading