Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | pmbaty | 1 | #include "brstdmem.h" |
2 | #include "harness/trace.h" |
||
3 | |||
4 | #include <stdlib.h> |
||
5 | |||
6 | // Global variables |
||
7 | br_allocator BrStdlibAllocator = { "malloc", BrStdlibAllocate, BrStdlibFree, BrStdlibInquire, BrStdlibAlign }; |
||
8 | br_allocator* _BrDefaultAllocator = &BrStdlibAllocator; |
||
9 | |||
10 | void* BrStdlibAllocate(br_size_t size, br_uint_8 type) { |
||
11 | void* m = malloc(size); |
||
12 | |||
13 | if (m == NULL) { |
||
14 | /* TODO BrFailure(); call*/ |
||
15 | } |
||
16 | |||
17 | return m; |
||
18 | } |
||
19 | |||
20 | void BrStdlibFree(void* mem) { |
||
21 | free(mem); |
||
22 | } |
||
23 | |||
24 | br_size_t BrStdlibInquire(br_uint_8 type) { |
||
25 | return 0; |
||
26 | } |
||
27 | |||
28 | br_uint_32 BrStdlibAlign(br_uint_8 type) { |
||
29 | return sizeof(void*); |
||
30 | } |