Avoid a few double lookups when expanding environment values

Change-Id: Ie84caee89a48d8006e6324c5a82901d01a5fac6c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
hjk
2023-03-02 14:19:42 +01:00
parent 47d375bbb4
commit 08bacd3f19
5 changed files with 10 additions and 10 deletions

View File

@@ -471,9 +471,9 @@ CommandLine DockerDevicePrivate::withDockerExecCmd(const CommandLine &cmd,
dockerCmd.addArg("-t");
if (env) {
env->forEachEntry([&](const QString &key, const QString &, bool) {
env->forEachEntry([&](const QString &key, const QString &value, bool) {
dockerCmd.addArg("-e");
dockerCmd.addArg(key + "=" + env->expandedValueForKey(key));
dockerCmd.addArg(key + "=" + env->expandVariables(value));
});
}

View File

@@ -872,8 +872,8 @@ QtSupport::ProFileReader *QmakeBuildSystem::createProFileReader(const QmakeProFi
rootProFileName,
deviceRoot());
env.forEachEntry([&](const QString &key, const QString &, bool) {
m_qmakeGlobals->environment.insert(key, env.expandedValueForKey(key));
env.forEachEntry([&](const QString &key, const QString &value, bool) {
m_qmakeGlobals->environment.insert(key, env.expandVariables(value));
});
m_qmakeGlobals->setCommandLineArguments(rootProFileName, qmakeArgs);

View File

@@ -61,8 +61,8 @@ QString QnxProcessImpl::fullCommandLine(const CommandLine &commandLine) const
ProcessArgs::quoteArg(m_setup.m_workingDirectory.toString()));
const Environment env = m_setup.m_environment;
env.forEachEntry([&](const QString &key, const QString &, bool) {
fullCommandLine += QString("%1='%2' ").arg(key).arg(env.expandedValueForKey(key));
env.forEachEntry([&](const QString &key, const QString &value, bool) {
fullCommandLine += QString("%1='%2' ").arg(key).arg(env.expandVariables(value));
});
fullCommandLine += QString::fromLatin1("%1 & echo $! > %2").arg(cmd).arg(m_pidFile);

View File

@@ -613,8 +613,8 @@ QString LinuxProcessInterface::fullCommandLine(const CommandLine &commandLine) c
cmd.addArgs(QString("echo ") + s_pidMarker + "$$" + s_pidMarker + " && ", CommandLine::Raw);
const Environment &env = m_setup.m_environment;
env.forEachEntry([&](const QString &key, const QString &, bool) {
cmd.addArgs(key + "='" + env.expandedValueForKey(key) + '\'', CommandLine::Raw);
env.forEachEntry([&](const QString &key, const QString &value, bool) {
cmd.addArgs(key + "='" + env.expandVariables(value) + '\'', CommandLine::Raw);
});
if (m_setup.m_terminalMode == TerminalMode::Off)

View File

@@ -172,9 +172,9 @@ bool MakeInstallStep::init()
const MakeInstallCommand cmd = buildSystem()->makeInstallCommand(rootDir);
if (cmd.environment.hasChanges()) {
Environment env = processParameters()->environment();
cmd.environment.forEachEntry([&](const QString &key, const QString &, bool enabled) {
cmd.environment.forEachEntry([&](const QString &key, const QString &value, bool enabled) {
if (enabled)
env.set(key, cmd.environment.expandedValueForKey(key));
env.set(key, cmd.environment.expandVariables(value));
});
processParameters()->setEnvironment(env);
}