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 f59295c127
commit 0ee3b2b197
634 changed files with 3451 additions and 3350 deletions
+9 -9
View File
@@ -57,7 +57,7 @@ JASChannel::~JASChannel() {
int JASChannel::play() {
JASDSPChannel* channel = JASDSPChannel::alloc(JSULoByte(mPriority), dspUpdateCallback, this);
if (channel == NULL) {
delete this;
JKR_DELETE(this);
return 0;
}
mDspCh = channel;
@@ -70,7 +70,7 @@ int JASChannel::playForce() {
JASDSPChannel* channel = JASDSPChannel::allocForce(JSULoByte(mPriority),
dspUpdateCallback, this);
if (channel == NULL) {
delete this;
JKR_DELETE(this);
return 0;
}
mDspCh = channel;
@@ -212,7 +212,7 @@ s32 JASChannel::dspUpdateCallback(u32 i_type, JASDsp::TChannel* i_channel, void*
case JASDSPChannel::CB_DROP:
_this->mDspCh->free();
_this->mDspCh = NULL;
delete _this;
JKR_DELETE(_this);
return -1;
default:
JUT_WARN(323, "Unexpected JASDSPChannel::UpdateStatus %d", i_type);
@@ -233,7 +233,7 @@ s32 JASChannel::initialUpdateDSPChannel(JASDsp::TChannel* i_channel) {
JUT_WARN_DEVICE(346, 2, "%s", "Lost wave data while playing");
mDspCh->free();
mDspCh = NULL;
delete this;
JKR_DELETE(this);
return -1;
}
@@ -241,7 +241,7 @@ s32 JASChannel::initialUpdateDSPChannel(JASDsp::TChannel* i_channel) {
JUT_WARN_DEVICE(357, 2, "%s","Lost bank data while playing");
mDspCh->free();
mDspCh = NULL;
delete this;
JKR_DELETE(this);
return -1;
}
@@ -311,7 +311,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
JUT_WARN_DEVICE(456, 2, "%s","Lost wave data while playing");
mDspCh->free();
mDspCh = NULL;
delete this;
JKR_DELETE(this);
return -1;
}
@@ -319,7 +319,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
JUT_WARN_DEVICE(467, 2, "%s", "Lost bank data while playing");
mDspCh->free();
mDspCh = NULL;
delete this;
JKR_DELETE(this);
return -1;
}
@@ -329,7 +329,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
if (mOscillators[0].isRelease()) {
mDspCh->free();
mDspCh = NULL;
delete this;
JKR_DELETE(this);
return -1;
}
} else {
@@ -350,7 +350,7 @@ s32 JASChannel::updateDSPChannel(JASDsp::TChannel* i_channel) {
if (i == 0 && mOscillators[i].isStop()) {
mDspCh->free();
mDspCh = NULL;
delete this;
JKR_DELETE(this);
return -1;
}
}