aboutsummaryrefslogtreecommitdiff
path: root/lib/pbdrv/ext/stdlib
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-18 17:29:25 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-18 17:29:25 +0200
commit3f3bef9c6bf0b9143da80e4b4363eb0362fb91c9 (patch)
treec4344b281fd589690b6b82bc6b5c2e91a4f2a13f /lib/pbdrv/ext/stdlib
parentc1007f50de3ad7284d4a1afa6bfb3b6e427c3556 (diff)
clean up code for getting main controller compiling again
Diffstat (limited to 'lib/pbdrv/ext/stdlib')
-rw-r--r--lib/pbdrv/ext/stdlib/include.cmake4
-rw-r--r--lib/pbdrv/ext/stdlib/pb-mem.c26
2 files changed, 30 insertions, 0 deletions
diff --git a/lib/pbdrv/ext/stdlib/include.cmake b/lib/pbdrv/ext/stdlib/include.cmake
new file mode 100644
index 0000000..fce788d
--- /dev/null
+++ b/lib/pbdrv/ext/stdlib/include.cmake
@@ -0,0 +1,4 @@
+target_sources(pbdrv-mod PRIVATE
+ "${CMAKE_CURRENT_LIST_DIR}/pb-mem.c"
+ )
+
diff --git a/lib/pbdrv/ext/stdlib/pb-mem.c b/lib/pbdrv/ext/stdlib/pb-mem.c
new file mode 100644
index 0000000..1f59a84
--- /dev/null
+++ b/lib/pbdrv/ext/stdlib/pb-mem.c
@@ -0,0 +1,26 @@
+#include <stdlib.h>
+#include <string.h>
+
+#include "../../pb-mem.h"
+#include "../../pb-types.h"
+
+__weak inline void * pb_malloc(size_t sz) {
+ return malloc(sz);
+}
+
+__weak inline void pb_free(void * ptr) {
+ free(ptr);
+}
+
+__weak inline void * pb_realloc(void * ptr, size_t sz) {
+ return realloc(ptr, sz);
+}
+
+__weak void * pb_memcpy(void * dest, const void * src, size_t sz) {
+ return memcpy(dest, src, sz);
+}
+
+int pb_memcmp(const void * a, const void * b, size_t sz) {
+ return memcmp(a, b, sz);
+}
+