Codechange: Pass reference instead of pointer to GUI*Lists. (#10822)

Pointer-avoidance.
This commit is contained in:
PeterN
2023-05-14 09:17:44 +01:00
committed by GitHub
parent 23ce42ad91
commit 64930c343a
6 changed files with 23 additions and 23 deletions

View File

@@ -324,10 +324,10 @@ void DrawVehicleEngine(int left, int right, int preferred_x, int y, EngineID eng
* @param el list to be sorted
* @param compare function for evaluation of the quicksort
*/
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
void EngList_Sort(GUIEngineList &el, EngList_SortTypeFunction compare)
{
if (el->size() < 2) return;
std::sort(el->begin(), el->end(), compare);
if (el.size() < 2) return;
std::sort(el.begin(), el.end(), compare);
}
/**
@@ -337,11 +337,11 @@ void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
* @param begin start of sorting
* @param num_items count of items to be sorted
*/
void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, size_t begin, size_t num_items)
void EngList_SortPartial(GUIEngineList &el, EngList_SortTypeFunction compare, size_t begin, size_t num_items)
{
if (num_items < 2) return;
assert(begin < el->size());
assert(begin + num_items <= el->size());
std::sort(el->begin() + begin, el->begin() + begin + num_items, compare);
assert(begin < el.size());
assert(begin + num_items <= el.size());
std::sort(el.begin() + begin, el.begin() + begin + num_items, compare);
}