diff options
author | Michael Lutz <michi@icosahedron.de> | 2019-04-02 21:31:41 +0200 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-04-09 22:45:15 +0200 |
commit | 8b1880187a15173c11b9aeed69db3d8be2fd36b3 (patch) | |
tree | 8abca4db0ddcc12e1eabee95f2b5b8624bd89ed9 /src/network | |
parent | e804173595d49a537503ea08bec4663117bae047 (diff) | |
download | openttd-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/network')
-rw-r--r-- | src/network/network_client.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/network/network_client.cpp b/src/network/network_client.cpp index 8c68b98f8..4dc5a8041 100644 --- a/src/network/network_client.cpp +++ b/src/network/network_client.cpp @@ -42,7 +42,7 @@ struct PacketReader : LoadFilter { static const size_t CHUNK = 32 * 1024; ///< 32 KiB chunks of memory. - AutoFreeSmallVector<byte *> blocks; ///< Buffer with blocks of allocated memory. + std::vector<byte *> blocks; ///< Buffer with blocks of allocated memory. byte *buf; ///< Buffer we're going to write to/read from. byte *bufe; ///< End of the buffer we write to/read from. byte **block; ///< The block we're reading from/writing to. @@ -54,6 +54,13 @@ struct PacketReader : LoadFilter { { } + ~PacketReader() override + { + for (auto p : this->blocks) { + free(p); + } + } + /** * Add a packet to this buffer. * @param p The packet to add. |