From 35eb5c86785fb30eeb5555355062ce29f84d0e84 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 17 Aug 2014 20:36:00 +0200 Subject: rcc: make qt_rcc_compare_hash a functor This allows the compiler to inline the function call into the std::sort instantiation. Change-Id: If2b948c1d7202d6a81afd8a58cc9fab50a9709c1 Reviewed-by: Giuseppe D'Angelo --- src/tools/rcc/rcc.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/tools/rcc/rcc.cpp') diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 71438726f7..9e4fe04e12 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -937,10 +937,14 @@ bool RCCResourceLibrary::writeDataNames() return true; } -static bool qt_rcc_compare_hash(const RCCFileInfo *left, const RCCFileInfo *right) +struct qt_rcc_compare_hash { - return qt_hash(left->m_name) < qt_hash(right->m_name); -} + typedef bool result_type; + result_type operator()(const RCCFileInfo *left, const RCCFileInfo *right) const + { + return qt_hash(left->m_name) < qt_hash(right->m_name); + } +}; bool RCCResourceLibrary::writeDataStructure() { @@ -962,7 +966,7 @@ bool RCCResourceLibrary::writeDataStructure() //sort by hash value for binary lookup QList m_children = file->m_children.values(); - std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash); + std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash()); //write out the actual data now for (int i = 0; i < m_children.size(); ++i) { @@ -981,7 +985,7 @@ bool RCCResourceLibrary::writeDataStructure() //sort by hash value for binary lookup QList m_children = file->m_children.values(); - std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash); + std::sort(m_children.begin(), m_children.end(), qt_rcc_compare_hash()); //write out the actual data now for (int i = 0; i < m_children.size(); ++i) { -- cgit v1.2.3