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 <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2014-08-17 20:36:00 +02:00
parent b3364cd8bf
commit 35eb5c8678

View File

@ -937,10 +937,14 @@ bool RCCResourceLibrary::writeDataNames()
return true; 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() bool RCCResourceLibrary::writeDataStructure()
{ {
@ -962,7 +966,7 @@ bool RCCResourceLibrary::writeDataStructure()
//sort by hash value for binary lookup //sort by hash value for binary lookup
QList<RCCFileInfo*> m_children = file->m_children.values(); QList<RCCFileInfo*> 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 //write out the actual data now
for (int i = 0; i < m_children.size(); ++i) { for (int i = 0; i < m_children.size(); ++i) {
@ -981,7 +985,7 @@ bool RCCResourceLibrary::writeDataStructure()
//sort by hash value for binary lookup //sort by hash value for binary lookup
QList<RCCFileInfo*> m_children = file->m_children.values(); QList<RCCFileInfo*> 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 //write out the actual data now
for (int i = 0; i < m_children.size(); ++i) { for (int i = 0; i < m_children.size(); ++i) {