summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-09-13 17:38:49 +0000
committerrubidium <rubidium@openttd.org>2009-09-13 17:38:49 +0000
commit67448246d32d448dab43fe4994a8e788cb727c45 (patch)
tree837bf7bda7a1d76ab7f8b25e27e4df3b0f8ec917 /src/core
parent45e3141444323e3bfb959c03686ba81303682833 (diff)
downloadopenttd-67448246d32d448dab43fe4994a8e788cb727c45.tar.xz
(svn r17527) -Codechange: use QSortT instead of qsort for sorting smallmaps
Diffstat (limited to 'src/core')
-rw-r--r--src/core/smallmap_type.hpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/core/smallmap_type.hpp b/src/core/smallmap_type.hpp
index a6f203774..68ee4aff5 100644
--- a/src/core/smallmap_type.hpp
+++ b/src/core/smallmap_type.hpp
@@ -13,6 +13,7 @@
#define SMALLMAP_TYPE_HPP
#include "smallvec_type.hpp"
+#include "sort_func.hpp"
/** Simple pair of data. Both types have to be POD ("Plain Old Data")! */
template <typename T, typename U>
@@ -105,14 +106,12 @@ struct SmallMap : SmallVector<SmallPair<T, U>, S> {
FORCEINLINE void SortByKey()
{
- qsort(this->Begin(), this->items, sizeof(Pair), KeySorter);
+ QSortT(this->Begin(), this->items, KeySorter);
}
- static int CDECL KeySorter(const void *a, const void *b)
+ static int CDECL KeySorter(const Pair *a, const Pair *b)
{
- const Pair *pa = (const Pair*)a;
- const Pair *pb = (const Pair*)b;
- return pa->first - pb->first;
+ return a->first - b->first;
}
};