diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-22 12:35:08 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2015-10-22 12:40:18 +0000 |
commit | 8848abe69fa957d5406659229cecdada83da8421 (patch) | |
tree | bec001ed4f959735e5371c1e5b4a55b4784e59c8 /src/qml/compiler/qv4ssa.cpp | |
parent | bef2dc8a236d4062f6b05b10cf99e6d081e4d6ce (diff) |
QML: Sanitize reading environment variables.
Where possible, use qEnvironmentVariableIsSet()/
qEnvironmentVariableIsEmpty() instead of checking on the
return value of qgetenv().
Where the value is required, add a check using one of
qEnvironmentVariableIsSet()/Empty().
Change-Id: Ia8b7534e6f5165bd8a6b4e63ccc139c42dd03056
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r-- | src/qml/compiler/qv4ssa.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp index 2b0383beec..449caeebb5 100644 --- a/src/qml/compiler/qv4ssa.cpp +++ b/src/qml/compiler/qv4ssa.cpp @@ -69,7 +69,7 @@ enum { DoVerification = 1 }; static void showMeTheCode(IR::Function *function, const char *marker) { - static bool showCode = !qgetenv("QV4_SHOW_IR").isNull(); + static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_IR"); if (showCode) { qDebug() << marker; QBuffer buf; @@ -3899,7 +3899,7 @@ bool tryOptimizingComparison(Expr *&expr) void cfg2dot(IR::Function *f, const QVector<LoopDetection::LoopInfo *> &loops = QVector<LoopDetection::LoopInfo *>()) { - static bool showCode = !qgetenv("QV4_SHOW_IR").isNull(); + static const bool showCode = qEnvironmentVariableIsSet("QV4_SHOW_IR"); if (!showCode) return; @@ -5198,7 +5198,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee // showMeTheCode(function); - static bool doSSA = qgetenv("QV4_NO_SSA").isEmpty(); + static bool doSSA = qEnvironmentVariableIsEmpty("QV4_NO_SSA"); if (!function->hasTry && !function->hasWith && !function->module->debugMode && doSSA) { // qout << "SSA for " << (function->name ? qPrintable(*function->name) : "<anonymous>") << endl; @@ -5266,7 +5266,7 @@ void Optimizer::run(QQmlEnginePrivate *qmlEngine, bool doTypeInference, bool pee verifyNoPointerSharing(function); } - static bool doOpt = qgetenv("QV4_NO_OPT").isEmpty(); + static const bool doOpt = qEnvironmentVariableIsEmpty("QV4_NO_OPT"); if (doOpt) { // qout << "Running SSA optimization..." << endl; worklist.reset(); |