summaryrefslogtreecommitdiff
path: root/src/saveload/saveload.cpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2019-04-02 21:31:41 +0200
committerMichael Lutz <michi@icosahedron.de>2019-04-09 22:45:15 +0200
commit8b1880187a15173c11b9aeed69db3d8be2fd36b3 (patch)
tree8abca4db0ddcc12e1eabee95f2b5b8624bd89ed9 /src/saveload/saveload.cpp
parente804173595d49a537503ea08bec4663117bae047 (diff)
downloadopenttd-8b1880187a15173c11b9aeed69db3d8be2fd36b3.tar.xz
Remove: AutoFreeSmallVector.
The last use was for storing a list of memory blocks. As the way these lists are accessed is very specific, it is easier to just write an explicit destructor instead of trying to exactly match the behaviour.
Diffstat (limited to 'src/saveload/saveload.cpp')
-rw-r--r--src/saveload/saveload.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index 721631fe6..f03e3d659 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -126,15 +126,22 @@ struct ReadBuffer {
/** Container for dumping the savegame (quickly) to memory. */
struct MemoryDumper {
- AutoFreeSmallVector<byte *> blocks; ///< Buffer with blocks of allocated memory.
- byte *buf; ///< Buffer we're going to write to.
- byte *bufe; ///< End of the buffer we write to.
+ std::vector<byte *> blocks; ///< Buffer with blocks of allocated memory.
+ byte *buf; ///< Buffer we're going to write to.
+ byte *bufe; ///< End of the buffer we write to.
/** Initialise our variables. */
MemoryDumper() : buf(NULL), bufe(NULL)
{
}
+ ~MemoryDumper()
+ {
+ for (auto p : this->blocks) {
+ free(p);
+ }
+ }
+
/**
* Write a single byte into the dumper.
* @param b The byte to write.