Skip to content

Commit 21ee775

Browse files
committed
Move memcopy() to a separate source file
Signed-off-by: Lukasz Dorau <[email protected]>
1 parent 0a92d8e commit 21ee775

File tree

7 files changed

+36
-11
lines changed

7 files changed

+36
-11
lines changed

test/CMakeLists.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,15 @@ if(LINUX)
311311
ipc_os_prov_consumer
312312
SRCS
313313
ipc_os_prov_consumer.c
314-
common/ipc_common.c)
314+
common/ipc_common.c
315+
common/ipc_os_prov_common.c)
315316
build_umf_test(
316317
NAME
317318
ipc_os_prov_producer
318319
SRCS
319320
ipc_os_prov_producer.c
320-
common/ipc_common.c)
321+
common/ipc_common.c
322+
common/ipc_os_prov_common.c)
321323
add_umf_ipc_test(TEST ipc_os_prov_anon_fd)
322324
add_umf_ipc_test(TEST ipc_os_prov_shm)
323325
else()

test/common/ipc_common.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,3 @@ int run_producer(int port, umf_memory_provider_ops_t *provider_ops,
473473

474474
return ret;
475475
}
476-
477-
void memcopy(void *dst, const void *src, size_t size, void *context) {
478-
(void)context;
479-
memcpy(dst, src, size);
480-
}

test/common/ipc_common.h

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

11-
#include <stdlib.h>
12-
1311
#include <umf/memory_provider.h>
1412

1513
// pointer to the function that returns void and accept two int values
@@ -26,6 +24,4 @@ int run_consumer(int port, umf_memory_provider_ops_t *provider_ops,
2624
void *provider_params, memcopy_callback_t memcopy_callback,
2725
void *memcopy_ctx);
2826

29-
void memcopy(void *dst, const void *src, size_t size, void *context);
30-
3127
#endif // IPC_COMMON_H

test/common/ipc_os_prov_common.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (C) 2024 Intel Corporation
3+
*
4+
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
5+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
*/
7+
8+
#include <string.h>
9+
10+
#include "ipc_os_prov_common.h"
11+
12+
void memcopy(void *dst, const void *src, size_t size, void *context) {
13+
(void)context;
14+
memcpy(dst, src, size);
15+
}

test/common/ipc_os_prov_common.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright (C) 2024 Intel Corporation
3+
*
4+
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
5+
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
*/
7+
8+
#ifndef IPC_OS_PROV_COMMON_H
9+
#define IPC_OS_PROV_COMMON_H
10+
11+
#include <stdlib.h>
12+
13+
void memcopy(void *dst, const void *src, size_t size, void *context);
14+
15+
#endif // IPC_OS_PROV_COMMON_H

test/ipc_os_prov_consumer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <umf/providers/provider_os_memory.h>
1212

1313
#include "ipc_common.h"
14+
#include "ipc_os_prov_common.h"
1415

1516
int main(int argc, char *argv[]) {
1617
if (argc < 2) {

test/ipc_os_prov_producer.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include <umf/providers/provider_os_memory.h>
1212

1313
#include "ipc_common.h"
14+
#include "ipc_os_prov_common.h"
1415

1516
int main(int argc, char *argv[]) {
1617
if (argc < 2) {

0 commit comments

Comments
 (0)