Skip to content

Commit 19a4d80

Browse files
authored
Merge pull request #1408 from lplewa/last
ensure that out paramenter is last function argument
2 parents 25375c6 + 2040db5 commit 19a4d80

30 files changed

+83
-83
lines changed

benchmark/benchmark_umf.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ struct fixed_provider : public provider_interface {
229229
provider_interface::params_ptr
230230
getParams(::benchmark::State &state) override {
231231
umf_fixed_memory_provider_params_handle_t raw_params = nullptr;
232-
umfFixedMemoryProviderParamsCreate(&raw_params, mem, size);
232+
umfFixedMemoryProviderParamsCreate(mem, size, &raw_params);
233233
if (!raw_params) {
234234
state.SkipWithError("Failed to create fixed provider params");
235235
return {nullptr, [](void *) {}};
@@ -351,8 +351,8 @@ struct disjoint_pool_stack : public disjoint_pool<Provider> {
351351
pools.push_back(rootPool); // root pool
352352

353353
umf_fixed_memory_provider_params_handle_t params_fixed = nullptr;
354-
umf_result = umfFixedMemoryProviderParamsCreate(
355-
&params_fixed, (void *)0x1, 0x1); // dummy
354+
umf_result = umfFixedMemoryProviderParamsCreate((void *)0x1, 0x1,
355+
&params_fixed); // dummy
356356

357357
size_t poolSize = firstPoolSize;
358358
size_t level_start = 0;

examples/dram_and_fsdax/dram_and_fsdax.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static umf_memory_pool_handle_t create_fsdax_pool(const char *path) {
5353
umf_result_t umf_result;
5454

5555
umf_file_memory_provider_params_handle_t params_fsdax = NULL;
56-
umf_result = umfFileMemoryProviderParamsCreate(&params_fsdax, path);
56+
umf_result = umfFileMemoryProviderParamsCreate(path, &params_fsdax);
5757
if (umf_result != UMF_RESULT_SUCCESS) {
5858
fprintf(stderr, "Failed to create the File Memory Provider params");
5959
return NULL;

include/umf/providers/provider_devdax_memory.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef UMF_DEVDAX_MEMORY_PROVIDER_H
99
#define UMF_DEVDAX_MEMORY_PROVIDER_H
1010

11-
#include <umf/providers/provider_os_memory.h>
11+
#include <umf/memory_provider.h>
1212

1313
#ifdef __cplusplus
1414
extern "C" {
@@ -24,13 +24,13 @@ typedef struct umf_devdax_memory_provider_params_t
2424
*umf_devdax_memory_provider_params_handle_t;
2525

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

3535
/// @brief Destroy parameters struct.
3636
/// @param hParams [in] handle to the parameters of the Devdax Memory Provider.

include/umf/providers/provider_file_memory.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef UMF_FILE_MEMORY_PROVIDER_H
99
#define UMF_FILE_MEMORY_PROVIDER_H
1010

11-
#include <umf/providers/provider_os_memory.h>
11+
#include <umf/memory_provider.h>
1212

1313
#ifdef __cplusplus
1414
extern "C" {
@@ -24,11 +24,11 @@ typedef struct umf_file_memory_provider_params_t
2424
*umf_file_memory_provider_params_handle_t;
2525

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

3333
/// @brief Destroy parameters struct.
3434
/// @param hParams handle to the parameters of the File Memory Provider.

include/umf/providers/provider_fixed_memory.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#ifndef UMF_FIXED_MEMORY_PROVIDER_H
99
#define UMF_FIXED_MEMORY_PROVIDER_H
1010

11-
#include <umf/providers/provider_os_memory.h>
11+
#include <umf/memory_provider.h>
1212

1313
#ifdef __cplusplus
1414
extern "C" {
@@ -24,12 +24,12 @@ typedef struct umf_fixed_memory_provider_params_t
2424
*umf_fixed_memory_provider_params_handle_t;
2525

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

3434
/// @brief Set the memory region in params struct. Overwrites the previous value.
3535
/// It provides an ability to use the same instance of params to create multiple

include/umf/providers/provider_os_memory.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef UMF_OS_MEMORY_PROVIDER_H
1111
#define UMF_OS_MEMORY_PROVIDER_H
1212

13-
#include "umf/memory_provider.h"
13+
#include <umf/memory_provider.h>
1414

1515
#ifdef __cplusplus
1616
extern "C" {

src/provider/provider_devdax_memory.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) {
2828
}
2929

3030
umf_result_t umfDevDaxMemoryProviderParamsCreate(
31-
umf_devdax_memory_provider_params_handle_t *hParams, const char *path,
32-
size_t size) {
31+
const char *path, size_t size,
32+
umf_devdax_memory_provider_params_handle_t *hParams) {
3333
(void)hParams;
3434
(void)path;
3535
(void)size;
@@ -562,8 +562,8 @@ const umf_memory_provider_ops_t *umfDevDaxMemoryProviderOps(void) {
562562
}
563563

564564
umf_result_t umfDevDaxMemoryProviderParamsCreate(
565-
umf_devdax_memory_provider_params_handle_t *hParams, const char *path,
566-
size_t size) {
565+
const char *path, size_t size,
566+
umf_devdax_memory_provider_params_handle_t *hParams) {
567567
libumfInit();
568568
if (hParams == NULL) {
569569
LOG_ERR("DevDax Memory Provider params handle is NULL");

src/provider/provider_file_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) {
2929
}
3030

3131
umf_result_t umfFileMemoryProviderParamsCreate(
32-
umf_file_memory_provider_params_handle_t *hParams, const char *path) {
32+
const char *path, umf_file_memory_provider_params_handle_t *hParams) {
3333
(void)hParams;
3434
(void)path;
3535
LOG_ERR("File memory provider is disabled!");
@@ -889,7 +889,7 @@ const umf_memory_provider_ops_t *umfFileMemoryProviderOps(void) {
889889
}
890890

891891
umf_result_t umfFileMemoryProviderParamsCreate(
892-
umf_file_memory_provider_params_handle_t *hParams, const char *path) {
892+
const char *path, umf_file_memory_provider_params_handle_t *hParams) {
893893
libumfInit();
894894
if (hParams == NULL) {
895895
LOG_ERR("File Memory Provider params handle is NULL");

src/provider/provider_fixed_memory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,8 @@ const umf_memory_provider_ops_t *umfFixedMemoryProviderOps(void) {
316316
}
317317

318318
umf_result_t umfFixedMemoryProviderParamsCreate(
319-
umf_fixed_memory_provider_params_handle_t *hParams, void *ptr,
320-
size_t size) {
319+
void *ptr, size_t size,
320+
umf_fixed_memory_provider_params_handle_t *hParams) {
321321
libumfInit();
322322
if (hParams == NULL) {
323323
LOG_ERR("Memory Provider params handle is NULL");

test/ctl/ctl_api.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ class Pool {
164164

165165
data = malloc(1024 * 1024);
166166
int ret =
167-
umfFixedMemoryProviderParamsCreate(&params, data, 1024 * 1024);
167+
umfFixedMemoryProviderParamsCreate(data, 1024 * 1024, &params);
168168
if (ret != UMF_RESULT_SUCCESS) {
169169
return 0;
170170
}

0 commit comments

Comments
 (0)