aboutsummaryrefslogtreecommitdiff
path: root/circuitpython/shared-module/qrio/quirc_alloc.h
diff options
context:
space:
mode:
authorRaghuram Subramani <raghus2247@gmail.com>2022-06-19 19:47:51 +0530
committerRaghuram Subramani <raghus2247@gmail.com>2022-06-19 19:47:51 +0530
commit4fd287655a72b9aea14cdac715ad5b90ed082ed2 (patch)
tree65d393bc0e699dd12d05b29ba568e04cea666207 /circuitpython/shared-module/qrio/quirc_alloc.h
parent0150f70ce9c39e9e6dd878766c0620c85e47bed0 (diff)
add circuitpython code
Diffstat (limited to 'circuitpython/shared-module/qrio/quirc_alloc.h')
-rw-r--r--circuitpython/shared-module/qrio/quirc_alloc.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/circuitpython/shared-module/qrio/quirc_alloc.h b/circuitpython/shared-module/qrio/quirc_alloc.h
new file mode 100644
index 0000000..b01fac5
--- /dev/null
+++ b/circuitpython/shared-module/qrio/quirc_alloc.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "py/gc.h"
+
+#if !MICROPY_GC_CONSERVATIVE_CLEAR
+// so that we can implement calloc as m_malloc
+#error Requires MICROPY_GC_CONSERVATIVE_CLEAR
+#endif
+
+#define QUIRC_MALLOC(x) gc_alloc((x), 0, false)
+#define QUIRC_CALLOC(x,y) gc_alloc((x) * (y), 0, false)
+#define QUIRC_FREE(x) gc_free((x))
+
+#define QUIRC_SMALL_STACK (1)