summaryrefslogtreecommitdiffstats
path: root/src/templates.h
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2019-06-25 00:42:23 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2019-06-25 00:42:23 +0200
commitcc731f47324cf58c899b242e34d661b651d3acef (patch)
treea096e4563ff09b208ff4697635baab2ec85395b4 /src/templates.h
parentCReplay::StorePedAnimation (diff)
downloadre3-cc731f47324cf58c899b242e34d661b651d3acef.tar
re3-cc731f47324cf58c899b242e34d661b651d3acef.tar.gz
re3-cc731f47324cf58c899b242e34d661b651d3acef.tar.bz2
re3-cc731f47324cf58c899b242e34d661b651d3acef.tar.lz
re3-cc731f47324cf58c899b242e34d661b651d3acef.tar.xz
re3-cc731f47324cf58c899b242e34d661b651d3acef.tar.zst
re3-cc731f47324cf58c899b242e34d661b651d3acef.zip
Diffstat (limited to '')
-rw-r--r--src/templates.h36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/templates.h b/src/templates.h
index d1ef99f0..7ed7043e 100644
--- a/src/templates.h
+++ b/src/templates.h
@@ -101,26 +101,26 @@ public:
n++;
return n;
}
- void ClearStorage(uint8 **flags, U **entries){
- delete[] flags;
- delete[] entries;
- *flags = nil;
- *entries = nil;
- }
- void CopyBack(uint8 **flags, U **entries){
- memcpy(m_flags, *flags, sizeof(Flags)*m_size);
- memcpy(m_entries, *entries, sizeof(U)*m_size);
- debug("Size copied:%d (%d)", sizeof(U)*m_size, sizeof(Flags)*m_size);
+ void ClearStorage(uint8 *&flags, U *&entries){
+ free(flags);
+ free(entries);
+ flags = nil;
+ entries = nil;
+ }
+ void CopyBack(uint8 *&flags, U *&entries){
+ memcpy(m_flags, flags, sizeof(uint8)*m_size);
+ memcpy(m_entries, entries, sizeof(U)*m_size);
+ debug("Size copied:%d (%d)\n", sizeof(U)*m_size, sizeof(Flags)*m_size);
m_allocPtr = 0;
ClearStorage(flags, entries);
- debug("CopyBack:%d (/%d)", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
- }
- void Store(uint8 **flags, U** entries){
- *flags = (Flags*)malloc(sizeof(Flags)*m_size);
- *entries = (U*)malloc(sizeof(U)*m_size);
- memcpy(*flags, m_flags, sizeof(Flags)*m_size);
- memcpy(*entries, m_entries, sizeof(U)*m_size);
- debug("Stored:%d (/%d)", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
+ debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
+ }
+ void Store(uint8 *&flags, U *&entries){
+ flags = (uint8*)malloc(sizeof(uint8)*m_size);
+ entries = (U*)malloc(sizeof(U)*m_size);
+ memcpy(flags, m_flags, sizeof(uint8)*m_size);
+ memcpy(entries, m_entries, sizeof(U)*m_size);
+ debug("Stored:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
}
};