diff options
Diffstat (limited to 'lib/pbdrv/ext/stdlib')
-rw-r--r-- | lib/pbdrv/ext/stdlib/include.cmake | 4 | ||||
-rw-r--r-- | lib/pbdrv/ext/stdlib/pb-mem.c | 26 |
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); +} + |