Line data Source code
1 : /*
2 : * Copyright (c) 2020 Project CHIP Authors
3 : *
4 : * Licensed under the Apache License, Version 2.0 (the "License");
5 : * you may not use this file except in compliance with the License.
6 : * You may obtain a copy of the License at
7 : *
8 : * http://www.apache.org/licenses/LICENSE-2.0
9 : *
10 : * Unless required by applicable law or agreed to in writing, software
11 : * distributed under the License is distributed on an "AS IS" BASIS,
12 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 : * See the License for the specific language governing permissions and
14 : * limitations under the License.
15 : */
16 :
17 : /**
18 : * @file
19 : * Provides a C-callable wrapper around CHIPMem.h.
20 : */
21 :
22 : #include <lib/support/CHIPMem.h>
23 : #include <lib/support/CHIPPlatformMemory.h>
24 :
25 : extern "C" {
26 :
27 0 : extern int CHIPPlatformMemoryInit(void * buf, size_t bufSize)
28 : {
29 0 : return static_cast<int>(chip::Platform::MemoryInit(buf, bufSize).AsInteger());
30 : }
31 :
32 0 : extern void CHIPPlatformMemoryShutdown()
33 : {
34 0 : return chip::Platform::MemoryShutdown();
35 : }
36 :
37 0 : extern void * CHIPPlatformMemoryAlloc(size_t size)
38 : {
39 0 : return chip::Platform::MemoryAlloc(size);
40 : }
41 :
42 0 : extern void * CHIPPlatformMemoryCalloc(size_t num, size_t size)
43 : {
44 0 : return chip::Platform::MemoryCalloc(num, size);
45 : }
46 :
47 0 : extern void * CHIPPlatformMemoryRealloc(void * p, size_t size)
48 : {
49 0 : return chip::Platform::MemoryRealloc(p, size);
50 : }
51 :
52 0 : extern void CHIPPlatformMemoryFree(void * p)
53 : {
54 0 : return chip::Platform::MemoryFree(p);
55 : }
56 : }
|