From b1a8d48e37a1cb7384e748495e5277890c5a5c9a Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sun, 7 Sep 2014 21:44:19 +0200 Subject: 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 --- src/corelib/plugin/qlibrary.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/corelib/plugin') 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; } -- cgit v1.2.3