summaryrefslogtreecommitdiff
path: root/src/lib/mpmalloc.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/mpmalloc.cc')
-rw-r--r--src/lib/mpmalloc.cc20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/lib/mpmalloc.cc b/src/lib/mpmalloc.cc
index db4a87a..2483a3a 100644
--- a/src/lib/mpmalloc.cc
+++ b/src/lib/mpmalloc.cc
@@ -2,7 +2,8 @@
#include "driver/stdout.h"
#include "lib/mpmalloc.h"
-void* mpcalloc(size_t nmemb, size_t size) {
+void* mpcalloc(size_t nmemb, size_t size)
+{
void* ret = calloc(nmemb, size);
#ifdef ADDR_20BIT
kout << "calloc:" << dec << (uint32_t)nmemb << "x" << (uint32_t)size << "@" << ret << endl;
@@ -12,7 +13,8 @@ void* mpcalloc(size_t nmemb, size_t size) {
return ret;
}
-void* mpmalloc(size_t size) {
+void* mpmalloc(size_t size)
+{
void* ret = malloc(size);
#ifdef ADDR_20BIT
kout << "malloc:" << dec << (uint32_t)size << "@" << ret << endl;
@@ -22,7 +24,19 @@ void* mpmalloc(size_t size) {
return ret;
}
-void mpfree(void* addr) {
+void* mprealloc(void* addr, size_t size)
+{
+ void* ret = realloc(addr, size);
+#ifdef ADDR_20BIT
+ kout << "realloc:" << addr << ":" << dec << (uint32_t)size << "@" << ret << endl;
+#else
+ kout << "realloc:" << addr << ":" << dec << size << "@" << ret << endl;
+#endif
+ return ret;
+}
+
+void mpfree(void* addr)
+{
kout << "free:" << addr << endl;
free(addr);
}