0ad/changeset_15334.diff
2014-06-18 15:17:30 -03:00

43 lines
1.1 KiB
Diff

Index: /ps/trunk/source/lib/allocators/headerless.cpp
===================================================================
--- /ps/trunk/source/lib/allocators/headerless.cpp (revision 15333)
+++ /ps/trunk/source/lib/allocators/headerless.cpp (revision 15334)
@@ -55,10 +55,12 @@
}
- FreedBlock(uintptr_t id, size_t size)
- : m_magic(s_magic), m_size(size), m_id(id)
- {
- }
-
- ~FreedBlock()
+ void Setup(uintptr_t id, size_t size)
+ {
+ m_magic = s_magic;
+ m_size = size;
+ m_id = id;
+ }
+
+ void Reset()
{
// clear all fields to prevent accidental reuse
@@ -411,6 +413,7 @@
FreedBlock* WriteTags(u8* p, size_t size)
{
- FreedBlock* freedBlock = new(p) FreedBlock(s_headerId, size);
- (void)new(Footer(freedBlock)) FreedBlock(s_footerId, size);
+ FreedBlock* freedBlock = (FreedBlock*)p;
+ freedBlock->Setup(s_headerId, size);
+ Footer(freedBlock)->Setup(s_footerId, size);
m_freeBlocks++;
@@ -431,6 +434,6 @@
FreedBlock* footer = Footer(freedBlock);
- freedBlock->~FreedBlock();
- footer->~FreedBlock();
+ freedBlock->Reset();
+ footer->Reset();
}