Isolate JKRHeap operator overloads

Fixes #25

This isolates the JKRHeap operator new/delete overloads. Every single new/delete site in the code has been replaced with a macro.

Sadly for new[] and delete[] we have to keep global operators. The global new[] just allocates into malloc() however, and delete[] goes into free() if it's not in a JKRHeap. So that's fine.
This commit is contained in:
PJB3005
2026-02-27 23:11:59 +01:00
parent 2204ad0813
commit 038ef4216f
634 changed files with 3451 additions and 3350 deletions
+10 -10
View File
@@ -32,15 +32,15 @@ public:
};
dJprev_c::dJprev_c(JStudio::TControl* param_1, const JUTGamePad& param_2) {
mOrthoGraph = new J2DOrthoGraph(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f);
mOrthoGraph = JKR_NEW J2DOrthoGraph(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f);
JUT_ASSERT(72, mOrthoGraph != NULL)
mFont = new JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
mFont = JKR_NEW JUTResFont((ResFONT*)JUTResFONT_Ascfont_fix12, NULL);
JUT_ASSERT(74, mFont != NULL)
m_parse = new tParse_();
m_parse = JKR_NEW tParse_();
JUT_ASSERT(76, m_parse != NULL)
mHeap = JKRExpHeap::create(0x100000, JKRHeap::getRootHeap2(), NULL);
JUT_ASSERT(82, mHeap != NULL)
mControl = new dJprevCtrl_c();
mControl = JKR_NEW dJprevCtrl_c();
JUT_ASSERT(86, mControl != NULL)
mHIOId = mDoHIO_createChild("JStudioPreviewer", mControl);
mControl->interface_setPad(&param_2);
@@ -53,23 +53,23 @@ dJprev_c::dJprev_c(JStudio::TControl* param_1, const JUTGamePad& param_2) {
dJprev_c::~dJprev_c() {
mDoHIO_deleteChild(mHIOId);
delete mControl;
JKR_DELETE(mControl);
mHeap->destroy();
delete m_parse;
delete mFont;
delete mOrthoGraph;
JKR_DELETE(m_parse);
JKR_DELETE(mFont);
JKR_DELETE(mOrthoGraph);
m_myObj = NULL;
}
void dJprev_c::create(JStudio::TControl* pControl, const JUTGamePad& pad) {
JUT_ASSERT(130, m_myObj == NULL);
new dJprev_c(pControl, pad);
JKR_NEW dJprev_c(pControl, pad);
JUT_ASSERT(132, m_myObj != NULL);
}
void dJprev_c::remove() {
JUT_ASSERT(147, m_myObj != NULL);
delete m_myObj;
JKR_DELETE(m_myObj);
}
void dJprev_c::update() {