Commit cc869680 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen

optimize lookup of built-in replace functions

use lowercasing only as a fallback
parent e5837686
......@@ -273,7 +273,7 @@ static struct {
QString strforever;
ProString strTEMPLATE;
ProString strQMAKE_DIR_SEP;
QHash<QString, int> expands;
QHash<ProString, int> expands;
QHash<ProString, int> functions;
QHash<ProString, int> varList;
QHash<ProString, ProString> varMap;
......@@ -340,7 +340,7 @@ void ProFileEvaluator::Private::initStatics()
{ "replace", E_REPLACE }
};
for (unsigned i = 0; i < sizeof(expandInits)/sizeof(expandInits[0]); ++i)
statics.expands.insert(QLatin1String(expandInits[i].name), expandInits[i].func);
statics.expands.insert(ProString(expandInits[i].name), expandInits[i].func);
static const struct {
const char * const name;
......@@ -1919,7 +1919,13 @@ ProStringList ProFileEvaluator::Private::evaluateExpandFunction(
ProStringList ProFileEvaluator::Private::evaluateExpandFunction(
const ProString &func, const ProStringList &args)
{
ExpandFunc func_t = ExpandFunc(statics.expands.value(func.toQString(m_tmp1).toLower()));
ExpandFunc func_t = ExpandFunc(statics.expands.value(func));
if (func_t == 0) {
const QString &fn = func.toQString(m_tmp1);
const QString &lfn = fn.toLower();
if (!fn.isSharedWith(lfn))
func_t = ExpandFunc(statics.expands.value(ProString(lfn)));
}
ProStringList ret;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment