diff options
Diffstat (limited to 'firmware/core_alloc.c')
-rw-r--r-- | firmware/core_alloc.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/core_alloc.c b/firmware/core_alloc.c index 2250f5c664..21dd1319dd 100644 --- a/firmware/core_alloc.c +++ b/firmware/core_alloc.c | |||
@@ -6,6 +6,9 @@ | |||
6 | 6 | ||
7 | /* not static so it can be discovered by core_get_data() */ | 7 | /* not static so it can be discovered by core_get_data() */ |
8 | struct buflib_context core_ctx; | 8 | struct buflib_context core_ctx; |
9 | |||
10 | /* debug test alloc */ | ||
11 | static int test_alloc; | ||
9 | void core_allocator_init(void) | 12 | void core_allocator_init(void) |
10 | { | 13 | { |
11 | buffer_init(); | 14 | buffer_init(); |
@@ -13,6 +16,17 @@ void core_allocator_init(void) | |||
13 | void *start = buffer_get_buffer(&size); | 16 | void *start = buffer_get_buffer(&size); |
14 | buflib_init(&core_ctx, start, size); | 17 | buflib_init(&core_ctx, start, size); |
15 | buffer_release_buffer(size); | 18 | buffer_release_buffer(size); |
19 | |||
20 | test_alloc = core_alloc("test", 112); | ||
21 | } | ||
22 | |||
23 | bool core_test_free(void) | ||
24 | { | ||
25 | bool ret = test_alloc > 0; | ||
26 | if (ret) | ||
27 | test_alloc = core_free(test_alloc); | ||
28 | |||
29 | return ret; | ||
16 | } | 30 | } |
17 | 31 | ||
18 | int core_alloc(const char* name, size_t size) | 32 | int core_alloc(const char* name, size_t size) |