Commit e5837686 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

optimize: make map() return a const ref

parent a49d1bff
......@@ -151,7 +151,7 @@ public:
void visitProFunctionDef(ushort tok, const ProString &name, const ushort *tokPtr);
void visitProVariable(ushort tok, const ProStringList &curr, const ushort *&tokPtr);
static inline ProString map(const ProString &var);
static inline const ProString &map(const ProString &var);
QHash<ProString, ProStringList> *findValues(const ProString &variableName,
QHash<ProString, ProStringList>::Iterator *it);
ProStringList &valuesRef(const ProString &variableName);
......@@ -418,9 +418,10 @@ void ProFileEvaluator::Private::initStatics()
ProString(mapInits[i].newname));
}
ProString ProFileEvaluator::Private::map(const ProString &var)
const ProString &ProFileEvaluator::Private::map(const ProString &var)
{
return statics.varMap.value(var, var);
QHash<ProString, ProString>::ConstIterator it = statics.varMap.constFind(var);
return (it != statics.varMap.constEnd()) ? it.value() : var;
}
......
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