summaryrefslogtreecommitdiff
path: root/shared-module/_protomatter/allocator.h
diff options
context:
space:
mode:
authorJeff Epler <jepler@gmail.com>2020-04-15 09:21:04 -0500
committerJeff Epler <jepler@gmail.com>2020-04-17 18:43:57 -0500
commita32337718d48fa83e5ebd8c7168019b4196acd0e (patch)
tree23ae7043e7f47477b95c5640b6dda0cd86078bc6 /shared-module/_protomatter/allocator.h
parentd1ff23e0046a6462d4939b4b8c79f10182fabf9d (diff)
Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it, like with _pixelbuf; but this proves not to be the case, as there's too little for the library to do.
Diffstat (limited to 'shared-module/_protomatter/allocator.h')
-rw-r--r--shared-module/_protomatter/allocator.h29
1 files changed, 0 insertions, 29 deletions
diff --git a/shared-module/_protomatter/allocator.h b/shared-module/_protomatter/allocator.h
deleted file mode 100644
index b7f517ce5..000000000
--- a/shared-module/_protomatter/allocator.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H
-#define MICROPY_INCLUDED_SHARED_MODULE_PROTOMATTER_ALLOCATOR_H
-
-#include <stdbool.h>
-#include "py/gc.h"
-#include "py/misc.h"
-#include "supervisor/memory.h"
-
-#define _PM_ALLOCATOR _PM_allocator_impl
-#define _PM_FREE(x) (_PM_free_impl((x)), (x)=NULL, (void)0)
-
-static inline void *_PM_allocator_impl(size_t sz) {
- if (gc_alloc_possible()) {
- return m_malloc(sz + sizeof(void*), true);
- } else {
- supervisor_allocation *allocation = allocate_memory(align32_size(sz), false);
- return allocation ? allocation->ptr : NULL;
- }
-}
-
-static inline void _PM_free_impl(void *ptr_in) {
- supervisor_allocation *allocation = allocation_from_ptr(ptr_in);
-
- if (allocation) {
- free_memory(allocation);
- }
-}
-
-#endif