mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-04 10:26:16 -04:00
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:
@@ -20,7 +20,7 @@ void Z2SoundHandles::deleteHandlesPool() {
|
||||
JUT_ASSERT(48, handle->getSupervisor() == this);
|
||||
|
||||
remove(handle);
|
||||
delete handle;
|
||||
JKR_DELETE(handle);
|
||||
}
|
||||
|
||||
handleNum_ = 0;
|
||||
@@ -64,7 +64,7 @@ Z2SoundHandlePool* Z2SoundHandles::getFreeHandle() {
|
||||
}
|
||||
|
||||
if (getNumHandles() < handleNum_) {
|
||||
Z2SoundHandlePool* handle = new Z2SoundHandlePool();
|
||||
Z2SoundHandlePool* handle = JKR_NEW Z2SoundHandlePool();
|
||||
if (handle != NULL) {
|
||||
append(handle);
|
||||
JUT_ASSERT(113, handle->getSupervisor() == this);
|
||||
@@ -141,7 +141,7 @@ void Z2SoundHandles::setPos(const JGeometry::TVec3<f32>& pos) {
|
||||
}
|
||||
else {
|
||||
remove(handle);
|
||||
delete handle;
|
||||
JKR_DELETE(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user