summaryrefslogtreecommitdiffstats
path: root/src/corelib/plugin/qlibrary.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-09-07 21:44:19 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-09-12 09:57:34 +0200
commitb1a8d48e37a1cb7384e748495e5277890c5a5c9a (patch)
treeefbaa1e985f2586c46b53c95e347294f407ada61 /src/corelib/plugin/qlibrary.cpp
parent699df74197dddf2feb2d469009e2794e012e9109 (diff)
QLibrary: simplify qt_debug_component()
Instead of initializing debug_env to -1 (thus forcing the variable into the data segment), and then overwriting the -1 with a read from the env-var, dynamically initialize the variable from the env-var directly, thus allowing the variable back into the bss segment (which doesn't occupy storage in the executable). There may have been a reason to do it this way when the old code could fail due to the memory allocation involved, but now with qEnvironmentVariableIntValue(), that is no longer a reason. Change-Id: I9f21b0783ff348f50b574395fc07f2869a14102e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/plugin/qlibrary.cpp')
-rw-r--r--src/corelib/plugin/qlibrary.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/corelib/plugin/qlibrary.cpp b/src/corelib/plugin/qlibrary.cpp
index df6b0a62d6..a5778d2d28 100644
--- a/src/corelib/plugin/qlibrary.cpp
+++ b/src/corelib/plugin/qlibrary.cpp
@@ -1129,10 +1129,7 @@ QLibrary::LoadHints QLibrary::loadHints() const
/* Internal, for debugging */
bool qt_debug_component()
{
- static int debug_env = -1;
- if (debug_env == -1)
- debug_env = QT_PREPEND_NAMESPACE(qEnvironmentVariableIntValue)("QT_DEBUG_PLUGINS");
-
+ static int debug_env = QT_PREPEND_NAMESPACE(qEnvironmentVariableIntValue)("QT_DEBUG_PLUGINS");
return debug_env != 0;
}