summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2023-03-07 13:34:18 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2023-03-07 13:34:18 -0400
commit5df9bdde16d30a8bfe520e178c5810a7163e9d6c (patch)
treea2f7ff6cacdfffb9c3e6bc9120c8458646027300
parent09ceed4fa79d2c5179060fc21ff39453705b80e6 (diff)
THeap: Replace `heap_x{malloc,free}` with `operator {new,delete}`
-rw-r--r--context.h8
-rw-r--r--include/pso/THeap.h7
-rw-r--r--src/pso/THeap.cpp4
3 files changed, 6 insertions, 13 deletions
diff --git a/context.h b/context.h
index 7da1dc5..c9a8dcd 100644
--- a/context.h
+++ b/context.h
@@ -542,10 +542,6 @@ extern char *get_sock_status_name(short code);
extern u16 to_be_uint16_t(u16 val);
extern u16 to_le_uint16_t(u16 val);
-// THeap.cpp
-extern void heap_xfree(void *ptr);
-extern void *heap_xmalloc(size_t size);
-
// TMainTask.cpp
extern void camera_stuff();
@@ -971,8 +967,8 @@ public:
public:
THeap(size_t size, int align);
~THeap();
- void *operator new(size_t size) { return heap_xmalloc(size); };
- void operator delete(void *ptr) { heap_xfree(ptr); };
+ void *operator new(size_t size);
+ void operator delete(void *ptr);
void *heap_alloc(size_t size);
void *heap_zalloc(size_t size);
void heap_free(void *ptr);
diff --git a/include/pso/THeap.h b/include/pso/THeap.h
index 6a94dee..1359369 100644
--- a/include/pso/THeap.h
+++ b/include/pso/THeap.h
@@ -6,9 +6,6 @@
#include <global_types.h>
#include <stdlib.h>
-void heap_xfree(void *ptr);
-void *heap_xmalloc(size_t size);
-
extern THeap *obj_heap;
extern THeap *alt_heap;
@@ -26,8 +23,8 @@ public:
public:
THeap(size_t size, int align);
~THeap();
- void *operator new(size_t size) { return heap_xmalloc(size); };
- void operator delete(void *ptr) { heap_xfree(ptr); };
+ void *operator new(size_t size);
+ void operator delete(void *ptr);
void *heap_alloc(size_t size);
void *heap_zalloc(size_t size);
void heap_free(void *ptr);
diff --git a/src/pso/THeap.cpp b/src/pso/THeap.cpp
index 5af77d1..3a6552d 100644
--- a/src/pso/THeap.cpp
+++ b/src/pso/THeap.cpp
@@ -6,11 +6,11 @@
THeap *obj_heap;
THeap *alt_heap;
-void heap_xfree(void *ptr) {
+void THeap::operator delete(void *ptr) {
}
-void *heap_xmalloc(size_t size) {
+void *THeap::operator new(size_t size) {
return NULL;
}