diff options
author | Henry Wilson <m3henry@googlemail.com> | 2018-09-23 17:16:49 +0100 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-03-26 20:15:57 +0000 |
commit | f3938fdb838685e76bba78974bb6e90e9afc6e22 (patch) | |
tree | 38261fac99ecd7fefa295b3789d026e4c575053b /src | |
parent | bad2c2154b97613bd6a045cfe1f05cff876da1e4 (diff) | |
download | openttd-f3938fdb838685e76bba78974bb6e90e9afc6e22.tar.xz |
Codechange: Replaced SmallVector::Reset() with std::vector::clear() + shrink_to_fit()
Diffstat (limited to 'src')
-rw-r--r-- | src/core/smallvec_type.hpp | 9 | ||||
-rw-r--r-- | src/network/network_content.cpp | 3 | ||||
-rw-r--r-- | src/newgrf_engine.cpp | 3 | ||||
-rw-r--r-- | src/saveload/waypoint_sl.cpp | 3 | ||||
-rw-r--r-- | src/stringfilter.cpp | 3 | ||||
-rw-r--r-- | src/texteff.cpp | 3 | ||||
-rw-r--r-- | src/vehicle.cpp | 3 |
7 files changed, 12 insertions, 15 deletions
diff --git a/src/core/smallvec_type.hpp b/src/core/smallvec_type.hpp index e78f98a50..7e0abec76 100644 --- a/src/core/smallvec_type.hpp +++ b/src/core/smallvec_type.hpp @@ -78,15 +78,6 @@ public: } /** - * Remove all items from the list and free allocated memory. - */ - inline void Reset() - { - std::vector<T>::clear(); - std::vector<T>::shrink_to_fit(); - } - - /** * Append an item and return it. * @param to_add the number of items to append * @return pointer to newly allocated item diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index d36aec6ba..8c038796f 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -555,7 +555,8 @@ void ClientNetworkContentSocketHandler::OnFailure() uint files, bytes; this->DownloadSelectedContent(files, bytes, true); - this->http_response.Reset(); + this->http_response.clear(); + this->http_response.shrink_to_fit(); this->http_response_index = -2; if (this->curFile != NULL) { diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 60d03fcc3..ce7cfdf24 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -1272,7 +1272,8 @@ void CommitVehicleListOrderChanges() } /* Clear out the queue */ - _list_order_changes.Reset(); + _list_order_changes.clear(); + _list_order_changes.shrink_to_fit(); } /** diff --git a/src/saveload/waypoint_sl.cpp b/src/saveload/waypoint_sl.cpp index 5e3a391f0..47d0c5ab3 100644 --- a/src/saveload/waypoint_sl.cpp +++ b/src/saveload/waypoint_sl.cpp @@ -146,7 +146,8 @@ void MoveWaypointsToBaseStations() UpdateWaypointOrder(&v->current_order); } - _old_waypoints.Reset(); + _old_waypoints.clear(); + _old_waypoints.shrink_to_fit(); } static const SaveLoad _old_waypoint_desc[] = { diff --git a/src/stringfilter.cpp b/src/stringfilter.cpp index 6045c19ef..b12abff7f 100644 --- a/src/stringfilter.cpp +++ b/src/stringfilter.cpp @@ -28,7 +28,8 @@ static const WChar STATE_QUOTE2 = '"'; */ void StringFilter::SetFilterTerm(const char *str) { - this->word_index.Reset(); + this->word_index.clear(); + this->word_index.shrink_to_fit(); this->word_matches = 0; free(this->filter_buffer); diff --git a/src/texteff.cpp b/src/texteff.cpp index 0f9fec247..41907e14d 100644 --- a/src/texteff.cpp +++ b/src/texteff.cpp @@ -108,7 +108,8 @@ void MoveAllTextEffects(uint delta_ms) void InitTextEffects() { - _text_effects.Reset(); + _text_effects.clear(); + _text_effects.shrink_to_fit(); } void DrawTextEffects(DrawPixelInfo *dpi) diff --git a/src/vehicle.cpp b/src/vehicle.cpp index d885a0458..0e05d68f2 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -693,7 +693,8 @@ static AutoreplaceMap _vehicles_to_autoreplace; void InitializeVehicles() { - _vehicles_to_autoreplace.Reset(); + _vehicles_to_autoreplace.clear(); + _vehicles_to_autoreplace.shrink_to_fit(); ResetVehicleHash(); } |